我是新手,WPF
也许很简单。我想不通为什么BorderBrush
不显示在 remove 上Button
。Button
默认情况下不可见,但在鼠标悬停时显示Button
。当鼠标悬停在应有Button
的基础TextBlock
显示上时,但没有Border
.
有没有人对我如何查看按钮的Border
.
以下是我的XAML
:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="150" Width="325">
<Window.Resources>
<Storyboard x:Key="MakeToolbarVisible">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.5"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="MakeToobarHidden">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Style x:Key="Toolbar">
<Style.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource MakeToobarHidden}"/>
</Trigger.ExitActions>
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource MakeToolbarVisible}"/>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Border>
<Grid Margin="0">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<TextBlock Text="enter some text here!" Margin="8,19.058,8,0" VerticalAlignment="Top" Foreground="#B43C1C26" HorizontalAlignment="Right"/>
<TextBox TextWrapping="WrapWithOverflow" Margin="8,19.058,0,2.463" FontSize="11" AcceptsReturn="True" AcceptsTab="True" Visibility="Visible" BorderThickness="0" Background="{x:Null}"/>
<WrapPanel Grid.Row="1" Margin="8,8,8,8">
<TextBlock Text="29.8.1995" Foreground="#B43C1C26" FontSize="10" />
</WrapPanel>
<StackPanel Grid.Column="1" Margin="5,5,5,8" Grid.RowSpan="2" Opacity="0" Style="{StaticResource Toolbar}">
<Button x:Name="Remove" BorderBrush="DarkRed" BorderThickness="1" Cursor="Hand">
<Button.Template>
<ControlTemplate>
<TextBlock Text="r" FontFamily="Marlett" FontSize="12"/>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
</Grid>
</Border>
</Grid>