我在wpf中有使用 ToggleButton 的代码。
<Grid>
<ToggleButton x:Name="pinButton" VerticalAlignment="Center" Width="auto" MaxWidth="26" Height="26"
Background="{DynamicResource MyBorderBlueGradientBrush}" Focusable="False"
DockPanel.Dock="Right" BorderThickness="0"
OverridesDefaultStyle="False" BorderBrush="{DynamicResource MyBorderBlueGradientBrush}" FontFamily="Webdings">
<Label x:Name="Pinback" Background="{DynamicResource MyBorderBlueGradientBrush}" Width="26" Height="26" BorderBrush="{DynamicResource MyBorderBlueGradientBrush}">
<Label x:Name="Pin" FontSize="18" Foreground="White" Content="" Width="25" Height="25" Background="Black" HorizontalAlignment="Center" VerticalAlignment="Center">
<Label.RenderTransform>
<RotateTransform Angle="16" CenterX="29" CenterY="0"></RotateTransform>
</Label.RenderTransform>
</Label>
</Label>
</ToggleButton>
</Grid>
当我运行此代码时,我得到了这个窗口。
所以我的问题是“内容如何变成图片图片”。当我更改其在其他图片中转换的内容时。
答案 0 :(得分:1)
该针脚来自XAML中Webdings FontFamily
的字符:
<Label x:Name="Pin" FontSize="18" Foreground="White" Content="" Width="25"
Height="25" Background="Black" HorizontalAlignment="Center"
VerticalAlignment="Center" />
请注意Content
属性...显然,您无法在此处看到该字符,因为该字体在网站上并不常见。另请注意FontFamily
中声明的ToggleButton
:
<ToggleButton x:Name="pinButton" VerticalAlignment="Center" Width="auto" MaxWidth="26"
Height="26" Background="Blue" Focusable="False" DockPanel.Dock="Right"
BorderThickness="0" OverridesDefaultStyle="False" BorderBrush="Blue"
FontFamily="Webdings">