【发布时间】:2023-06-05 22:33:01
【问题描述】:
我正在开发 windows phone 应用程序而不是 silverlight 只是基本应用程序。 有没有办法让我的应用程序的按钮看起来像瓷砖。这意味着我想要页面内的按钮瓷砖。 我想做类似this
但是当我将此代码放在我的页面上时,我在标记的行中收到类似“未定义默认命名空间”的错误。
*<Style x:Key="TileListBoxItemStyle" TargetType="ListBoxItem">*
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="FontSize" Value="64"/>
<Setter Property="Margin" Value="12,12,0,0"/>
<Setter Property="Background" Value="{StaticResource PhoneAccentBrush}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Width" Value="173"/>
<Setter Property="Height" Value="173"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid>
<Rectangle Fill="{TemplateBinding Background}"/>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
【问题讨论】:
-
不清楚您的问题。请明确您需要什么。
-
在您定义的模板中使用图像控件并尝试一下
-
你能详细说明一下吗..我需要做什么..