-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
Make XAML style writing more like CSS
- Less code
- Be more logical
- Easier to read
I don't know if future versions have that design in mind
Let's say I want a button with rounded corners
// version now
<Window.Resources>
<Style x:Key="Btn" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderThickness="1" Width="60" Height="32" CornerRadius="3" Background="#4C5EE9">
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="#fff"></Setter>
</Style>
</Window.Resources>
<Button Style="{StaticResource Btn}" Content="Button"></Button>
// expect version 1
<Style x:Key="Btn" TargetType="Button">
Width=60,
Height=32,
Background="#4C5EE9",
Foreground="#FFF",
BorderRadius=3
</Style>
<Button Style="{StaticResource Btn}" Content="Button"></Button>
// expect version 2
<Style>
Btn {
Width:60,
Height:32,
Background:"#4C5EE9",
Color:"#FFF",
BorderRadius: 3
}
</Style>
<Button Style="{StaticResource Btn}" Content="Button"></Button>
OR
<Button Class="{Btn}" Content="Button"></Button>
redradist, mrNo0b, D-Diyare, XamDR and cpydownguidevnet, JanTamis, horeaper, bkaankose, legistek and 4 moreGalaxiaGuy, DEVBOX10, cschwarz, wangfu91, lindexi and 4 more