|
4 | 4 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
6 | 6 | xmlns:local="clr-namespace:CutCode" |
| 7 | + xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit" |
7 | 8 | d:DataContext="{d:DesignInstance local:AddViewModel}" |
8 | 9 | xmlns:s="https://github.com/canton7/Stylet" |
9 | 10 | mc:Ignorable="d"> |
10 | 11 |
|
11 | 12 | <Grid.Resources> |
12 | | - |
| 13 | + <local:HighlightingDefinitionConverter x:Key="HighlightingDefinitionConverter"/> |
13 | 14 | <Style x:Key="textBoxStyle" TargetType="TextBox"> |
14 | 15 | <Setter Property="BorderThickness" Value="0"/> |
15 | 16 | <Setter Property="Foreground" Value="White"/> |
|
70 | 71 | </Grid.RowDefinitions> |
71 | 72 | <Label Grid.Row="0" Content="Language" FontFamily="{StaticResource poppins_regular}" Foreground="{Binding textBoxForeground}"/> |
72 | 73 | <ComboBox Grid.Row="1" Style="{StaticResource comboBoxStyle}" Background="{Binding textBoxBackground}" Width="130" Margin="5,0,0,0" |
73 | | - SelectedIndex="0" |
| 74 | + SelectedIndex="0" SelectedValue="{Binding CurrentLang}" |
74 | 75 | BorderBrush="{Binding textBoxBackground}" ItemsSource="{Binding AllLangs}" Foreground="{Binding textBoxForeground}" FontFamily="{StaticResource poppins_regular}"> |
75 | 76 | <ComboBox.Resources> |
76 | 77 | <Style TargetType="ComboBoxItem"> |
|
103 | 104 | </Grid> |
104 | 105 | </Border> |
105 | 106 |
|
106 | | - <Border Grid.Row="2" BorderThickness="0" Background="{Binding textBoxBackground}" Margin="10,15,12,5" CornerRadius="8" |
| 107 | + <Border Grid.Row="2" BorderThickness="0" Background="{Binding richtextBoxBackground}" Margin="10,15,12,5" CornerRadius="8" |
107 | 108 | HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
108 | | - <ScrollViewer Style="{StaticResource ScrollViewerStyle}"> |
109 | | - <Grid> |
110 | | - <local:CustomTextEditor x:Name="codeEditor" ScrollViewer.HorizontalScrollBarVisibility="Auto" Margin="5,9,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" |
111 | | - Background="{Binding textBoxBackground}" Foreground="{Binding textBoxForeground}" TextWrapping="Wrap" AcceptsReturn="True" |
112 | | - Text="{Binding code}" FontFamily="{StaticResource firacode}" AcceptsTab="True" FontSize="14" BorderThickness="0"/> |
113 | | - |
114 | | - <TextBlock Text="Start by typing your code here ..." FontSize="15" FontFamily="{StaticResource poppins_regular}" |
115 | | - IsHitTestVisible="False" Foreground="#929292" Margin="10,7,0,0"> |
116 | | - <TextBlock.Style> |
117 | | - <Style TargetType="{x:Type TextBlock}"> |
118 | | - <Setter Property="Visibility" Value="Collapsed"/> |
119 | | - <Style.Triggers> |
120 | | - <DataTrigger Binding="{Binding Text, ElementName=codeEditor}" Value=""> |
121 | | - <Setter Property="Visibility" Value="Visible"/> |
122 | | - </DataTrigger> |
123 | | - </Style.Triggers> |
124 | | - </Style> |
125 | | - </TextBlock.Style> |
126 | | - </TextBlock> |
127 | | - </Grid> |
128 | | - </ScrollViewer> |
| 109 | + <local:BindableAvalonEditor |
| 110 | + xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit" |
| 111 | + Background="{Binding richtextBoxBackground}" |
| 112 | + Foreground="{Binding textBoxForeground}" |
| 113 | + BorderThickness="0" |
| 114 | + Margin="5,9,0,0" |
| 115 | + VerticalAlignment="Stretch" |
| 116 | + HorizontalAlignment="Stretch" |
| 117 | + FontFamily="{StaticResource firacode}" |
| 118 | + FontSize="14" |
| 119 | + ShowLineNumbers="True" |
| 120 | + ScrollViewer.CanContentScroll="True" |
| 121 | + Text="{Binding code}" |
| 122 | + SyntaxHighlighting="{Binding CurrentLang, Converter={StaticResource HighlightingDefinitionConverter}}"/> |
129 | 123 | </Border> |
130 | 124 |
|
131 | 125 | <Grid Grid.Row="3"> |
|
0 commit comments