vue-java-tutorials/CSharp/WPFTutorial/WPF-20-ReusableStyleResources/MainWindow.xaml

50 lines
2.0 KiB
XML

<Window x:Class="WPF_20_ReusableStyleResources.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<!-- <Style TargetType="Button"> -->
<!-- <Setter Property="Width" Value="100" /> -->
<!-- <Setter Property="Height" Value="40" /> -->
<!-- <Setter Property="FontSize" Value="20" /> -->
<!-- </Style> -->
<Style TargetType="Button" x:Key="ConfirmationStyle">
<Setter Property="Width" Value="100" />
<Setter Property="Height" Value="40" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="LimeGreen" />
<Setter Property="Content" Value="OK" />
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="60" />
</Grid.RowDefinitions>
<StackPanel VerticalAlignment="Center">
<!-- <StackPanel.Resources> -->
<!-- <Style TargetType="TextBox"> -->
<!-- <Setter Property="Width" Value="200" /> -->
<!-- <Setter Property="Height" Value="40" /> -->
<!-- <Setter Property="FontSize" Value="20" /> -->
<!-- <Setter Property="FontWeight" Value="Light" /> -->
<!-- </Style> -->
<!-- </StackPanel.Resources> -->
<TextBox Width="250" />
<TextBox />
<TextBox />
<Button Margin="0 5 0 0">Normal</Button>
<Button Margin="0 5 0 0">Normal</Button>
</StackPanel>
<Grid Grid.Row="1">
<Button Style="{StaticResource ConfirmationStyle}" />
</Grid>
</Grid>
</Window>