Skip to content

Commit b6a2d3a

Browse files
committed
Improved ListBox layout in Highlighting Editor for better text visibility
1 parent 0e7f41d commit b6a2d3a

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

src/CodeSnip/Views/HighlightingEditorView/HighlightingEditorView.xaml

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
xmlns:local="clr-namespace:CodeSnip.Views.HighlightingEditorView"
88
xmlns:behaviors="clr-namespace:Microsoft.Xaml.Behaviors;assembly=Microsoft.Xaml.Behaviors"
99
xmlns:helpers="clr-namespace:CodeSnip.Helpers"
10+
d:DataContext="{d:DesignInstance Type={x:Type local:HighlightingEditorViewModel}}"
1011
x:Name="flyHighlightingEditor"
1112
MinWidth="500"
12-
MaxWidth="600"
13-
mah:HeaderedControlHelper.HeaderMargin="10"
13+
MaxWidth="600"
1414
mc:Ignorable="d"
1515
d:DesignHeight="400"
1616
d:DesignWidth="300">
@@ -24,49 +24,62 @@
2424
<TextBlock Grid.Row="0" Text="{Binding Message}" FontWeight="Bold" Margin="0,0,0,10" />
2525
<ListBox Grid.Row="1"
2626
ItemsSource="{Binding HighlightingColors}"
27-
SelectedItem="{Binding SelectedColor, Mode=TwoWay}">
27+
SelectedItem="{Binding SelectedColor, Mode=TwoWay}"
28+
ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
2829
<ListBox.ItemTemplate>
2930
<DataTemplate>
30-
<Border BorderBrush="LightGray" BorderThickness="0,0,0,1" Padding="2">
31-
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
32-
<TextBlock Text="{Binding Name}" Width="120" VerticalAlignment="Center" />
33-
<Rectangle Width="16" Height="16" Margin="5,0,0,0" VerticalAlignment="Center">
31+
<Border BorderBrush="{DynamicResource MahApps.Brushes.Gray3}" BorderThickness="0,0,0,1" Padding="2">
32+
<Grid VerticalAlignment="Center">
33+
<Grid.ColumnDefinitions>
34+
<ColumnDefinition Width="2*" />
35+
<!-- Name -->
36+
<ColumnDefinition Width="Auto" />
37+
<!-- Rectangle -->
38+
<ColumnDefinition Width="Auto" />
39+
<!-- Weight label and combobox -->
40+
<ColumnDefinition Width="Auto" />
41+
<!-- Style label and combobox -->
42+
</Grid.ColumnDefinitions>
43+
44+
<TextBlock Text="{Binding Name}" Grid.Column="0" VerticalAlignment="Center"
45+
TextTrimming="CharacterEllipsis" ToolTip="{Binding Name}" />
46+
47+
<Rectangle Width="16" Height="16" Margin="5,0,0,0" VerticalAlignment="Center" Grid.Column="1">
3448
<Rectangle.Fill>
3549
<SolidColorBrush Color="{Binding Foreground}" />
3650
</Rectangle.Fill>
3751
</Rectangle>
3852

39-
<!-- Label i ComboBox za FontWeight -->
40-
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20,0,0,0">
53+
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20,0,0,0" Grid.Column="2">
4154
<TextBlock Text="Weight:" VerticalAlignment="Center" Margin="0,0,5,0" />
4255
<ComboBox Width="80"
43-
SelectedItem="{Binding FontWeight, Mode=TwoWay}"
44-
ItemsSource="{Binding AvailableFontWeights}"
45-
IsEditable="False"
46-
VerticalAlignment="Center">
56+
SelectedItem="{Binding FontWeight, Mode=TwoWay}"
57+
ItemsSource="{Binding AvailableFontWeights}"
58+
IsEditable="False"
59+
VerticalAlignment="Center">
4760
<ComboBox.ItemTemplate>
4861
<DataTemplate>
4962
<TextBlock Text="{Binding}" />
5063
</DataTemplate>
5164
</ComboBox.ItemTemplate>
5265
</ComboBox>
5366
</StackPanel>
54-
<!-- Label i ComboBox za FontStyle -->
55-
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20,0,0,0">
67+
68+
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20,0,0,0" Grid.Column="3">
5669
<TextBlock Text="Style:" VerticalAlignment="Center" Margin="0,0,5,0" />
5770
<ComboBox Width="80"
58-
SelectedItem="{Binding FontStyle, Mode=TwoWay}"
59-
ItemsSource="{Binding AvailableFontStyles}"
60-
IsEditable="False"
61-
VerticalAlignment="Center">
71+
SelectedItem="{Binding FontStyle, Mode=TwoWay}"
72+
ItemsSource="{Binding AvailableFontStyles}"
73+
IsEditable="False"
74+
VerticalAlignment="Center">
6275
<ComboBox.ItemTemplate>
6376
<DataTemplate>
6477
<TextBlock Text="{Binding}" />
6578
</DataTemplate>
6679
</ComboBox.ItemTemplate>
6780
</ComboBox>
6881
</StackPanel>
69-
</StackPanel>
82+
</Grid>
7083
</Border>
7184
</DataTemplate>
7285
</ListBox.ItemTemplate>

0 commit comments

Comments
 (0)