WPF binding i style
Sidder og kan ikke få en Binding til at virke!Min style til MainContentButton arver fra Button style. Jeg skal sætte ButtonText Label Content til Text Dependencyproperty i MainContentButton klassen, men jeg får ikke noget frem, hvad gør jeg galt?
<Style TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderThickness="1"
BorderBrush="DarkGray"
CornerRadius="3"
Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type cc:MainContentButton}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Margin" Value="2"/>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Image Grid.Row="0" />
<Label Name="ButtonText"
Content="{Binding Text}"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="16"
FontWeight="Bold"
Foreground="White"/>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>