回复 1楼bj_zm的帖子
请参考完整的自定义模板代码:
- <Style x:Name="C1MessageBoxContentStyle1" TargetType="c1:C1MessageBoxContent">
- <Setter Property="OKText" Value="OK"/>
- <Setter Property="CancelText" Value="Cancel"/>
- <Setter Property="YesText" Value="Yes"/>
- <Setter Property="NoText" Value="No"/>
- <Setter Property="ButtonStyle">
- <Setter.Value>
- <Style TargetType="Button">
- <Setter Property="Margin" Value="5,0,5,0"/>
- <Setter Property="VerticalAlignment" Value="Center"/>
- <Setter Property="MinWidth" Value="75"/>
- <Setter Property="Background" Value="Green"></Setter>
- </Style>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="c1:C1MessageBoxContent">
- <Grid Width="350" Background="#FFF29191"> <!--背景色-->
- <Grid.RowDefinitions>
- <RowDefinition/>
- <RowDefinition Height="50"/>
- </Grid.RowDefinitions>
- <Grid Margin="10">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Image Height="48" Margin="0,0,20,0" x:Name="Icon" Width="48" Stretch="None" />
- <TextBlock VerticalAlignment="Center" Grid.Column="1" Text="{TemplateBinding Message}" TextWrapping="Wrap" FontWeight="Bold" FontStyle="Italic"/>
- </Grid>
- <Grid Grid.Row="1" Background="#FFF0F0F0">
- <Grid.RowDefinitions>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <StackPanel HorizontalAlignment="Right" Margin="0,0,5,0" x:Name="Buttons" VerticalAlignment="Center" Grid.Row="1" Orientation="Horizontal"/>
- </Grid>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
复制代码 |