Skip to content

Commit 2cacc37

Browse files
committed
Optimize desktop DataGrid RowHeight adjusts with font size
1 parent 0b1b681 commit 2cacc37

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

v2rayN/v2rayN.Desktop/Assets/GlobalStyles.axaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@
2020
<Style Selector="Grid.Margin8">
2121
<Setter Property="Margin" Value="8" />
2222
</Style>
23-
</Styles>
23+
<Style Selector="DataGrid">
24+
<Setter Property="RowHeight" Value="24" />
25+
</Style>
26+
</Styles>

v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ private void ModifyFontSize()
119119
Value = size,
120120
});
121121
Application.Current?.Styles.Add(style);
122+
123+
ModifyFontSizeEx(size);
124+
}
125+
126+
private void ModifyFontSizeEx(double size)
127+
{
128+
//DataGrid
129+
var rowHeight = 20 + (size / 2);
130+
var style = new Style(x => x.OfType<DataGrid>());
131+
style.Add(new Setter(DataGrid.RowHeightProperty, rowHeight));
132+
Application.Current?.Styles.Add(style);
122133
}
123134

124135
private void ModifyFontFamily()

v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@
787787
Classes="Margin8" />
788788

789789
<TextBlock
790+
x:Name="labLinuxSudoPassword"
790791
Grid.Row="7"
791792
Grid.Column="0"
792793
VerticalAlignment="Center"
@@ -800,6 +801,7 @@
800801
HorizontalAlignment="Left"
801802
Classes="Margin8" />
802803
<TextBlock
804+
x:Name="labLinuxSudoPasswordTip"
803805
Grid.Row="7"
804806
Grid.Column="2"
805807
VerticalAlignment="Center"

v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ public OptionSettingWindow()
174174
if (Utils.IsWindows())
175175
{
176176
txbSettingsExceptionTip2.IsVisible = false;
177+
txtLinuxSudoPassword.IsVisible = false;
178+
labLinuxSudoPassword.IsVisible = false;
179+
labLinuxSudoPasswordTip.IsVisible = false;
177180
}
178181
else
179182
{

0 commit comments

Comments
 (0)