0
有人可以幫助解決這個問題。XAML中的圖像按鈕
我試圖讓下面的代碼,以便我可以注入我想要的圖像到這個按鈕樣式。這個按鈕風格在整個應用程序
<Style TargetType="Button" x:Key="ButtonIsChecked">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<CheckBox Content="{Binding Content}" Name="CheckBox_Logon" IsHitTestVisible="False" IsChecked="False">
<CheckBox.Template>
<ControlTemplate TargetType="{x:Type CheckBox}">
<WrapPanel>
<Image
Source="/AdminUltimate;component/Images/Icons/Windows.ico"
Width="15" Margin="3"
Visibility="{Binding IsChecked, Converter={StaticResource BoolToVis}, ElementName=DisableIcons}"/>
<TextBlock Text="{Binding}" VerticalAlignment="Center"/>
</WrapPanel>
</ControlTemplate>
</CheckBox.Template>
</CheckBox>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
當前使用情況使用
<Button Content="Login" Style="{StaticResource ButtonIsChecked}"/>
我想這樣做
<Button Content="Login" Style="{StaticResource ButtonIsChecked}" imgsrc="Pathtoimage"/>
這可能嗎?