I have added the nuget package for WinUI and added the merged dictionary in App.xaml and new style does appear for all controls that are not affected by the Style
directives. However simple using of Style
causes the Setters of Style
to be applied to the original UWP templates and not to WinUI templates. For example this code:
<Grid.Resources>
<Style TargetType="ComboBox">
<Setter Property="Width" Value="160"/>
</Style>
</Grid.Resources>
will cause that ComboBoxes appear without corner radius and with more thick borders than if the above is not applied.
Any solution for this?
To override properties on the WinUI style, you can use based-on styles.
So in your specific case, you can do the following:
<Style TargetType="ComboBox" BasedOn="{StaticResource DefaultComboBoxStyle}">
<Setter Property="Width" Value="160"/>
</Style>
That way, you create a new style which is based on the WinUI style (called DefaultComboBoxStyle) where you override the width property.