【发布时间】:2014-09-24 14:50:24
【问题描述】:
我已经编写了这段代码,用于在按钮中插入带有文本的背景图像。所以我有这个:
<Button Style="{StaticResource TransparentButton}"
Grid.Column="0"
Grid.Row="0"
Command="{Binding Path=MovePreviousCommand}"
Width="150">
<Button.Content>
<StackPanel Orientation="Horizontal">
<Grid>
<Image Source="./Resources/Images/bottone_indietro.png" Width="130"/>
<Label Content="{x:Static res:Strings.GestoreWizardView_Button_MovePrevious}"
HorizontalAlignment="Center" VerticalAlignment="Center"
Margin="48,10,26,8" Style="{StaticResource LabelStyleButton}"
/>
</Grid>
</StackPanel>
</Button.Content>
</Button>
这是一个样式按钮
<Style TargetType="Button" x:Key="TransparentButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="Transparent">
<ContentPresenter/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
现在我想在鼠标悬停按钮时更改背景图像。
我们能帮帮我吗?
最好的后卫。
【问题讨论】:
-
是按钮的背景还是整个窗口的背景?
-
是按钮的背景
标签: c# wpf xaml button background-image