Giter VIP home page Giter VIP logo

Comments (6)

WelterDevelopment avatar WelterDevelopment commented on June 16, 2024

Thank you for your request!
The actual differnces compared to the current implemantation I can identify from the editor in your picture are:

Visual stuff:

  • Bindable background colors for the line number column and the text area (in this case it's both transparent to get the mica/acrylic effect shine through)
  • Bindable font (to select MonoLisa/Fira/... instead of Consolas)
  • Bindable selected line number color
  • Different shades for selected and unselected line numbers
  • Vertical indentation lines inside of the text area with the same color as unselected line numbers
  • Current line has a semi-transparent shade of the unselected line number color (instead of the current rounded frame)

Logical stuff:

  • Bindable current member hierarchy for external display e.g. as a breadcrumb bar

Lots of good ideas; I will work on that.

from codeeditorcontol-winui.

katuak avatar katuak commented on June 16, 2024

Yep, mainly things like the font and the colors used. I am willing to help on making these changes. It would be cool if it looked like a native windows widget*

from codeeditorcontol-winui.

WelterDevelopment avatar WelterDevelopment commented on June 16, 2024

I implemented some of the ideas:
Screenshot 2022-08-15 184128

Font (string) and ShowIndentGuides (Enum: None, Line, Dashed) are new DependencyProperties that can be set in xaml with your ViewModel data:

<codewriter:CodeWriter x:Name="CW" Grid.Row="1" Margin="12,0,0,0" 
CornerRadius="{StaticResource OverlayCornerRadius}" 
Background="Transparent" 
Font="{Binding Font}" 
Language="{Binding EditorLanguage}" 
Text="{Binding Text, Mode=TwoWay}"  
TextChanged="CW_TextChanged" 
ErrorOccured="CW_ErrorOccured" 
FontSize="{Binding FontSize, Mode=TwoWay}" 
TabLength="{Binding TabLength}" 
RequestedTheme="{Binding RequestedTheme}" 
ShowIndentGuides="{Binding ShowIndentGuides}" 
ShowControlCharacters="{Binding ShowControlCharacters}" 
ShowLineNumbers="{Binding ShowLineNumbers}" 
ShowLineMarkers="{Binding ShowLineMarkers}" 
IsFoldingEnabled="{Binding IsFoldingEnabled}" 
IsWrappingEnabled="{Binding IsWrappingEnabled}" 
ShowScrollbarMarkers="{Binding ShowScrollbarMarkers}" 
ShowHorizontalTicks="{Binding ShowHorizontalTicks}" 
ShowScrollbars="True"/>

Regarding Fonts: I tried to add Fira Code and JetBrains Mono. The first seems to work but the text rendering gets reeeally slow. The second one does not work at all (I guess only specific types of ttf files are allowed). So as of now we are stuck to the preinstalled Windows monospaced fonts. I added the ones I know to the TestApp: "Consolas", "Courier New", "Lucida Sans Typewriter", "Cascadia Code", "Cascadia Mono".

Regarding 'colors used': All editor colors are exposed as public properties. They are not yet implemented as DependencyProperties but you can change all colors at runtime by e.g. by setting CodeWriter.Color_Background in C#. To change colors that are used to draw stuff in the Win2D Canvas (like CodeWriter.Color_LineNumber) at runtime you need to additionally call CodeWriter.Invalidate(). I will consolidate the Colors by removing redundancies and I will turn then into bindable DependencyProperties with automatic invalidation.

If you meant the syntax highlighting colors: They can be set globally by the static publicly exposed Dictionary<Token, Color> EditorOptions.TokenColors. Or (as shown in the TestApp) you can define a bindable List<TokenDefinition> to directly update the syntax colors at a color change:
Screenshot 2022-08-15 185811

For the line number and the indent guides to change color depending if the corresponding line is selected, I need to change the way how the stacked Canvases work. I will deal with that once I do the general code refactoring mentioned in the discussion #9 (comment).

from codeeditorcontol-winui.

katuak avatar katuak commented on June 16, 2024

Well done man!!!! I'm impressed. I'm starting out on C# UIs (XAML), where did you learn all this stuff? Docs aren't very good :/
Edit: You're doing this for free, the visual studio team should hire you

from codeeditorcontol-winui.

WelterDevelopment avatar WelterDevelopment commented on June 16, 2024

Haha thanks, but .NET is just a hobby for me.
Well, the docs used to be sooo good back in the UWP days. Now that Win32, WPF, UWP, Windows App SDK and .NET MAUI all coexist, it is very messy. There is no good documentation for Windows App SDK, even though it is supposed to be the main tool for developing Windows apps. I started learning UWP development with Bob Tabor who made a very good and extensive video course on Channel 9 (now called Microsoft Learn): https://docs.microsoft.com/en-us/shows/windows-10-development-for-absolute-beginners/. Most of the XAML and C# syntax and namespaces haven't changed (exception: Windows.UI (=old UWP Controls) turned into Microsoft.UI (=new WinUI 3 controls)), so you can follow the course even using the Windows App SDK. Once you understand how MVVM and DataTemplates work you are good to go to develop for any .NET-based runtime; the basics haven't changed since WPF.

from codeeditorcontol-winui.

katuak avatar katuak commented on June 16, 2024

Closing in order to clean up my feed, thanks for implementing some of the changes ;)

from codeeditorcontol-winui.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.