我正在使用Code4fun toolkit for Windows Phone中的消息提示。
我在构建组件时遇到了问题。我尝试为它创建一个普通的stye,并尝试在显示组件之前更改属性:
var messagePrompt = new MessagePrompt
{
Title = "UserControl test",
Body = new PopupView(),
IsAppBarVisible = true,
IsCancelVisible = true,
BorderThickness = new Thickness(0),
Margin = new Thickness(0),
Padding = new Thickness(0),
BorderBrush = new SolidColorBrush(Color.FromArgb(255, 0, 82, 161)),
Background = new SolidColorBrush(Color.FromArgb(255, 0, 82, 161))
};
messagePrompt.Show();
使用正确的颜色设置背景,但忽略BorderThickness,Margin和Padding设置!
我已经尝试过谷歌的一些常见的例子,但没有运气!
那么,我如何从coding4fun?
设置MessagePrompt组件的样式答案 0 :(得分:0)
以下是Code4fun的MessagePrompt模板:
<Grid VerticalAlignment="Stretch">
<Rectangle Fill="{StaticResource TransparentBrush}" />
<Border VerticalAlignment="Top"
Margin="10" // because this line you can't change margin
Background="{TemplateBinding Background}"
BorderThickness="1" // because this line you can't change BorderThickness
BorderBrush="{StaticResource PhoneForegroundBrush}">
<StackPanel Margin="10">
<TextBlock Text="{TemplateBinding Title}"
Margin="0,-10,-25,10" FontSize="30"
TextWrapping="Wrap" FontFamily="Segoe WP Light" />
<ContentPresenter Content="{TemplateBinding Body}" />
<StackPanel Margin="0,10,0,0"
Name="actionButtonArea"
Orientation="Horizontal"
HorizontalAlignment="Center" />
</StackPanel>
</Border>
</Grid>
填充被忽略,因为此属性未在模板中使用。 如何看待,如果要更改此属性,则必须更改MessagePrompt的模板。