Невозможно установить текст на кнопке с помощью стиля в WPF
это моя кнопка управления
<Button Grid.Row="1" Height="49" Width="249" Style="{StaticResource TriggerStyleBlue}" Name="btnStart" Click="btnStart_Click" Cursor="Hand" VerticalContentAlignment="Top" Content="Start Now" Foreground="White" VerticalAlignment="Top" HorizontalAlignment="Left" />
я не могу установить текст на кнопке
Что я уже пробовал:
мой стиль
<Style x:Key="TriggerStyleBlue" TargetType="{x:Type Button}"> <Setter Property="Foreground"> <Setter.Value> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#9B000000" Offset="0"/> <GradientStop Color="White" Offset="1"/> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border TextBlock.Foreground="{TemplateBinding Foreground}" x:Name="Border" CornerRadius="1" BorderThickness="1"> <Border.Background> <ImageBrush ImageSource= "..\Resources\BTN_REGistryscan_Normal.jpg" /> </Border.Background> <!--<Border.Effect> <DropShadowEffect/> </Border.Effect>--> </Border> <ControlTemplate.Triggers> <Trigger Property="IsPressed" Value="True"> <!--<Setter TargetName="Border" Property="Border.Effect" Value="{x:Null}"/>--> <Setter Property="Background" TargetName="Border"> <Setter.Value> <ImageBrush ImageSource="..\Resources\BTN_REGistryscan_Down.jpg"/> </Setter.Value> </Setter> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" TargetName="Border"> <Setter.Value> <ImageBrush ImageSource="..\Resources\BTN_REGistryscan_Hover.jpg"/> </Setter.Value> </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
То, что IAM делаю не так ?
srilekhamenon
https://stackoverflow.com/questions/9913422/change-button-background-image-on-hover-click-using-a-template