Skip to content

Commit c385e9b

Browse files
committed
Fixing DPI issues | Removed UseLayoutRounding and SnapToDevicePixels
1 parent e8cd8ca commit c385e9b

File tree

9 files changed

+8
-23
lines changed

9 files changed

+8
-23
lines changed

Aronium.Wpf.Toolkit/Themes/CalloutStyle.xaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
<Setter Property="CornerRadius" Value="3" />
1212
<Setter Property="Padding" Value="12,15" />
1313
<Setter Property="VerticalContentAlignment" Value="Center" />
14-
<Setter Property="SnapsToDevicePixels" Value="False" />
15-
<Setter Property="UseLayoutRounding" Value="True" />
1614
<Setter Property="Template">
1715
<Setter.Value>
1816
<ControlTemplate TargetType="{x:Type local:Callout}">

Aronium.Wpf.Toolkit/Themes/ClosableTabControlStyle.xaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@
217217

218218
<ContentPresenter Content="{TemplateBinding Header}" />
219219

220+
<!--Use negative bottom margin to eliminate wierd empty space between scroll viewer and the bottom border-->
220221
<ScrollViewer x:Name="PART_ScrollViewer"
222+
Margin="0, 0, 0, -1"
221223
Grid.Column="1"
222224
CanContentScroll="True"
223225
Background="Transparent"
@@ -226,7 +228,7 @@
226228
<TabPanel x:Name="HeaderPanel"
227229
IsItemsHost="True"
228230
Panel.ZIndex="10"
229-
Margin="0,-1"
231+
Margin="0"
230232
KeyboardNavigation.TabIndex="1"
231233
Background="Transparent" />
232234
</ScrollViewer>
@@ -284,7 +286,8 @@
284286

285287
<Border BorderBrush="{TemplateBinding BorderBrush}"
286288
Grid.ColumnSpan="5"
287-
BorderThickness="0,2,0,0" Grid.Row="1">
289+
BorderThickness="0,2,0,0"
290+
Grid.Row="1">
288291
<ContentPresenter x:Name="PART_SelectedContentHost"
289292
Margin="{TemplateBinding Padding}"
290293
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
@@ -298,7 +301,6 @@
298301
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}" />
299302
<Setter Property="Foreground" Value="{DynamicResource Foreground}" />
300303
<Setter Property="BorderBrush" Value="{DynamicResource Accent}" />
301-
<Setter Property="SnapsToDevicePixels" Value="True" />
302304
<Style.Triggers>
303305
<Trigger Property="TabStripPlacement" Value="Top">
304306
<Setter Property="Template" Value="{StaticResource TabControlTemplate}" />

Aronium.Wpf.Toolkit/Themes/ComboBoxStyle.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
<Setter Property="Height" Value="24" />
8686
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
8787
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
88-
<Setter Property="SnapsToDevicePixels" Value="True" />
8988
<Setter Property="Padding" Value="5,3,23,3" />
9089
<Setter Property="VerticalContentAlignment" Value="Center" />
9190
<Setter Property="Template">

Aronium.Wpf.Toolkit/Themes/FlyoutStyle.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<Style TargetType="{x:Type local:Flyout}">
88
<Setter Property="Foreground" Value="{DynamicResource Foreground}" />
99
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}" />
10-
<Setter Property="SnapsToDevicePixels" Value="True" />
1110
<Setter Property="Template">
1211
<Setter.Value>
1312
<ControlTemplate TargetType="local:Flyout">

Aronium.Wpf.Toolkit/Themes/NumericUpDownStyle.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<Setter Property="Opacity" Value="1" />
1010
<Setter Property="Padding" Value="4,0" />
1111
<Setter Property="Margin" Value="0" />
12-
<Setter Property="UseLayoutRounding" Value="True" />
1312
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
1413
<Setter Property="Template">
1514
<Setter.Value>

Aronium.Wpf.Toolkit/Themes/ScrollBarStyle.xaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<Thickness x:Key="HorizontalDefaultMargin">0,3,0,0</Thickness>
88

99
<Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
10-
<Setter Property="SnapsToDevicePixels" Value="True"/>
1110
<Setter Property="OverridesDefaultStyle" Value="true"/>
1211
<Setter Property="Focusable" Value="false"/>
1312
<Setter Property="Template">
@@ -41,7 +40,6 @@
4140
</Style>
4241

4342
<Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
44-
<Setter Property="SnapsToDevicePixels" Value="True"/>
4543
<Setter Property="OverridesDefaultStyle" Value="true"/>
4644
<Setter Property="IsTabStop" Value="false"/>
4745
<Setter Property="Focusable" Value="false"/>
@@ -56,7 +54,6 @@
5654
</Style>
5755

5856
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
59-
<Setter Property="SnapsToDevicePixels" Value="True"/>
6057
<Setter Property="OverridesDefaultStyle" Value="True"/>
6158
<Setter Property="IsTabStop" Value="false"/>
6259
<Setter Property="Focusable" Value="false"/>
@@ -177,7 +174,6 @@
177174

178175
<Style TargetType="{x:Type ScrollBar}">
179176
<Setter Property="BorderThickness" Value="0"/>
180-
<Setter Property="SnapsToDevicePixels" Value="True"/>
181177
<Setter Property="OverridesDefaultStyle" Value="true"/>
182178
<Style.Triggers>
183179
<Trigger Property="Orientation" Value="Horizontal">

Aronium.Wpf.Toolkit/Themes/SplitButtonStyle.xaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
<ColumnDefinition Width="Auto" />
1616
</Grid.ColumnDefinitions>
1717

18-
<!--Buttons in grid do not fit the layout, for that reason margin right is set to -1 and -0.5, to fit full area-->
19-
20-
<Button Name="PART_Button" BorderThickness="0" Margin="0,0,-1,0" Padding="{TemplateBinding Padding}" Content="{TemplateBinding Content}"/>
18+
<Button Name="PART_Button" BorderThickness="0" Margin="0,0,0,0" Padding="{TemplateBinding Padding}" Content="{TemplateBinding Content}"/>
2119
<Rectangle Margin="0" Fill="{TemplateBinding BorderBrush}" Width="1" Grid.Column="1" />
22-
<ToggleButton Name="PART_DropDownButton" Margin="0,0,-0.5,0" Padding="5,0" VerticalContentAlignment="Center" BorderThickness="0" Grid.Column="2">
20+
<ToggleButton Name="PART_DropDownButton" Margin="0,0,0,0" Padding="5,0" VerticalContentAlignment="Center" BorderThickness="0" Grid.Column="2">
2321
<Path Fill="{Binding ElementName=PART_DropDownButton, Path=Foreground}"
2422
x:Name="Arrow"
2523
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"

Aronium.Wpf.Toolkit/Themes/TabControlStyle.xaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<Style TargetType="{x:Type TabItem}">
77
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}" />
88
<Setter Property="Foreground" Value="{DynamicResource Foreground}" />
9-
<Setter Property="SnapsToDevicePixels" Value="True" />
109
<Setter Property="FontSize" Value="13" />
1110
<Setter Property="Padding" Value="13,4" />
1211
<Setter Property="Template">
@@ -72,8 +71,6 @@
7271
<Setter TargetName="arrow" Property="VerticalAlignment" Value="Center" />
7372
<Setter TargetName="arrow" Property="Margin" Value="-5,0.5,0,0" />
7473
<Setter TargetName="ContentSite" Property="HorizontalAlignment" Value="Right" />
75-
<!--When turned on, for some reason, arrow is not positioned properly-->
76-
<Setter Property="UseLayoutRounding" Value="False" />
7774
</Trigger>
7875

7976
<Trigger Property="TabItem.TabStripPlacement" Value="Bottom">
@@ -210,8 +207,6 @@
210207
<Setter Property="Foreground" Value="{DynamicResource Foreground}" />
211208
<Setter Property="BorderBrush" Value="{DynamicResource Accent}" />
212209
<Setter Property="OverridesDefaultStyle" Value="True" />
213-
<!-- If UseLayoutRounding is turned off, arrow with left layout is not positioned propely -->
214-
<Setter Property="UseLayoutRounding" Value="True" />
215210
<Style.Triggers>
216211
<Trigger Property="TabStripPlacement" Value="Top">
217212
<Setter Property="Template" Value="{StaticResource TabControlTemplate}" />
@@ -259,7 +254,6 @@
259254
<Setter Property="Background" Value="Transparent" />
260255
<Setter Property="BorderBrush" Value="Transparent" />
261256
<Setter Property="Foreground" Value="{DynamicResource Foreground}" />
262-
<Setter Property="SnapsToDevicePixels" Value="True" />
263257
<Setter Property="FontSize" Value="13" />
264258
<Setter Property="Padding" Value="14,7" />
265259
<Setter Property="Template">
@@ -329,6 +323,7 @@
329323
<Setter Property="Template" Value="{StaticResource MaterialTabControlTemplate}" />
330324
<Setter Property="HorizontalContentAlignment" Value="Left" />
331325
<Setter Property="ItemContainerStyle" Value="{StaticResource MaterialTabItemStyle}" />
326+
<Setter Property="SnapsToDevicePixels" Value="True" />
332327
</Style>
333328

334329
</ResourceDictionary>

Aronium.Wpf.Toolkit/Themes/ToggleSwitchStyle.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@
110110

111111
<Style TargetType="{x:Type local:ToggleSwitch}">
112112
<Setter Property="IsThreeState" Value="False" />
113-
<Setter Property="SnapsToDevicePixels" Value="True" />
114113
<Setter Property="Background" Value="{DynamicResource OnOffButtonSliderBackground}" />
115114
<Setter Property="BackgroundChecked" Value="{DynamicResource OnOffButtonSliderBackgroundChecked}" />
116115
<Setter Property="BorderBrushChecked" Value="{DynamicResource OnOffButtonBorderBrushCheked}" />

0 commit comments

Comments
 (0)