所以我有"window"
(不是Window
而是Grid
):
代码:
<Grid Name="gridDeleteAllWindows">
<Grid.RowDefinitions>
<RowDefinition Height="110"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Margin="0,0,0,0">
<Label Content="Delete All Files"
FontSize="20"
HorizontalAlignment="Center"
FontWeight="Bold"
Margin="0,0,0,0"/>
<Label Content="Are you sure you want to remove"
HorizontalAlignment="Center"
Margin="0,0,0,0"/>
<Label Content="all the files ?"
HorizontalAlignment="Center"
Margin="0,0,0,0"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<Border BorderThickness="0,1,0,0" BorderBrush="#55B3B3B6">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125"/>
<ColumnDefinition Width="125"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="#55B3B3B6" BorderThickness="0,0,1,0" Grid.Column="0">
<Grid>
<Button Name="btnDeleteAllFilesYes"
Content="Yes"
FontSize="16"
Style="{StaticResource ButtonDefaultStyle}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Click="btnDeleteAllFilesYes_Click"
Margin="0,0,0,0"/>
</Grid>
</Border>
<Border BorderBrush="#55B3B3B6" BorderThickness="0,0,1,0" Grid.Column="1">
<Grid>
<Button Name="btnDeleteAllFilesNo"
Content="No"
FontSize="16"
Background="Transparent"
Style="{StaticResource ButtonDefaultStyle}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Click="btnDeleteAllFilesNo_Click"
Margin="0,0,0,0"/>
</Grid>
</Border>
</Grid>
</Border>
</Grid>
</Grid>
Style
:
<Style x:Key="ButtonDefaultStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource MetroFlatButton}" >
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="#FF103766"/>
<Setter Property="Foreground" Value="Gainsboro"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Gray"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#FF6899D3"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border TextBlock.Foreground="{TemplateBinding Foreground}"
x:Name="Border"
CornerRadius="0"
BorderBrush="Transparent"
Background="{TemplateBinding Background}"
BorderThickness="1">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.5" />
<VisualTransition GeneratedDuration="0" To="Pressed" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
</VisualState>
<VisualState x:Name="Pressed">
</VisualState>
<VisualState x:Name="Disabled">
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter Margin="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
RecognizesAccessKey="True" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
我希望在color
Button
MouseEnter
时添加另一个Trigger
,所以我添加<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Gray"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
:
match_all
结果:
正如你所看到的那样,我的圆角现在已经丢失,所以我只需要你的帮助来修复它。