<StackPanel Name="StpAddDel" Orientation="Horizontal" HorizontalAlignment="Right" Margin="5">
<RadioButton Name="rdbactive" Content="Active" GroupName="actinact" VerticalAlignment="Center" Margin="5,0" Width="50" Height="15" Foreground="Blue"/>
<RadioButton Name="rdbinactive" Content="InActive" GroupName="actinact" VerticalAlignment="Center" Margin="5,0" Width="60" Height="15" Foreground="Blue"/>
<Button Name="BtnAdd" Height="20" Width="20" Margin="5,0" Template="{StaticResource AddImgBtnTemplate}" />
<Button Name="BtnDel" Height="20" Width="20" Margin="5,0" Template="{StaticResource DelImgBtnTemplate}" />
</StackPanel>
这是我的wpf窗口中提供的代码。如何将图像添加到MVVM中的这些单选按钮。
答案 0 :(得分:0)
这会将图片添加到单选按钮的背景中。
myRadioButton.Content = new Image()
{
Source = (new ImageSourceConverter()).ConvertFrom(
"Images/pic.png") as
ImageSource
};