Reputation: 5962
i am learning trigger in WPF
. from here trigger demo
but when i write code similar to that tutorial then it show "the property key does not exist"
my code
<Window.Resources>
<Style x:key="ButtonStyle" TargetType="{x:Type Button}">
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Content="My Button" HorizontalAlignment="Left" VerticalAlignment="Top" MaxWidth="100" Padding="6" Margin="8"/>
</Grid>
Upvotes: 1
Views: 144
Reputation: 7903
K in key needs to be in capital x:Key
Make sure you have included the namespace 'x'
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
in the Windows tag
Upvotes: 3