在 windows phone 应用程序中自定义单选按钮
Customize radio button in windows phone app
我有两个收音机 button.I 想要添加自定义图像而不是默认样式。
示例:我想为选中的单选按钮显示图片 1,为所有其他未选中的单选按钮显示图片 2。
当前单选按钮代码,我试过了
<RadioButton x:Name="rbCashFee" Content="Send with Cash out fee" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsChecked="True" Height="59" Foreground="Black" RenderTransformOrigin="0.5,0.5" Margin="8,0" Background="{x:Null}">
<RadioButton.RenderTransform>
<CompositeTransform/>
</RadioButton.RenderTransform>
</RadioButton>
<RadioButton x:Name="rbNCashFee" Content="Send without Cash out fee" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="59" Foreground="Black" Margin="8,0">
<RadioButton.BorderBrush>
<SolidColorBrush Color="#000"/>
</RadioButton.BorderBrush>
<RadioButton.Background>
<SolidColorBrush Color="#fff"/>
</RadioButton.Background>
</RadioButton>
有好心人可以帮我做一下吗
您必须更改控件'templates.Read 本文以了解如何操作。
https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.control.template
与其在 xaml 中尝试,我建议您在该页面的 .cs 文件中使用 SelectionChanged 事件并在 .cs 文件中动态设置单选按钮的属性。
我有两个收音机 button.I 想要添加自定义图像而不是默认样式。
示例:我想为选中的单选按钮显示图片 1,为所有其他未选中的单选按钮显示图片 2。
当前单选按钮代码,我试过了
<RadioButton x:Name="rbCashFee" Content="Send with Cash out fee" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsChecked="True" Height="59" Foreground="Black" RenderTransformOrigin="0.5,0.5" Margin="8,0" Background="{x:Null}">
<RadioButton.RenderTransform>
<CompositeTransform/>
</RadioButton.RenderTransform>
</RadioButton>
<RadioButton x:Name="rbNCashFee" Content="Send without Cash out fee" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="59" Foreground="Black" Margin="8,0">
<RadioButton.BorderBrush>
<SolidColorBrush Color="#000"/>
</RadioButton.BorderBrush>
<RadioButton.Background>
<SolidColorBrush Color="#fff"/>
</RadioButton.Background>
</RadioButton>
有好心人可以帮我做一下吗
您必须更改控件'templates.Read 本文以了解如何操作。 https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.control.template
与其在 xaml 中尝试,我建议您在该页面的 .cs 文件中使用 SelectionChanged 事件并在 .cs 文件中动态设置单选按钮的属性。