我正在尝试为Skypes通知创建类似的东西,但是我对动画有一些问题.
我希望整个窗口在顶部和底部都有一个边框,然后在中间的内容中用它来"推"边框.我已经设法创造了几乎我想要的东西,但它从顶部向下增长,我希望它能够推动底部边框文具.
我在中间部分使用以下动画,我想出现
<DoubleAnimation
Storyboard.TargetName="contentGrid"
BeginTime="00:00:0.2"
Storyboard.TargetProperty="(FrameworkElement.Height)"
From="0"
Duration="0:0:0.5"/>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢
其余的XAMl:
<Grid Name="notificationPanel">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="contentGrid" Storyboard.TargetProperty="(FrameworkElement.Height)" From="0" Duration="0:0:0.5"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Grid.Triggers>
<Grid Grid.Row="0" Background="CornflowerBlue">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Name="notificationTitle" Padding="5" FontSize="14" Foreground="White">
Call Manager - Incoming Call
</TextBlock>
<Path Name="closeButton" Grid.Column="1" Margin="5,10,10,0" Fill="White" Data="F1 M 2.28484e-007,1.33331L 1.33333,0L 4.00001,2.66669L 6.66667,6.10352e-005L 8,1.33331L 5.33334,4L 8,6.66669L 6.66667,8L 4,5.33331L 1.33333,8L 1.086e-007,6.66669L 2.66667,4L 2.28484e-007,1.33331 Z " />
</Grid>
<Grid …Run Code Online (Sandbox Code Playgroud) 我有两个用户控件,第一个带有一个列表框,该列表框绑定到一个客户列表,显示每个客户的一些简单细节.
第二个用户控件我想更详细地查看在第一个usercontrol的列表框中选择的客户.
是否可以在第二个控件中设置绑定以绑定到第一个用户控件中的选定项?
我的列表框:
<ListBox Name="lstCustomer" ItemsSource="{Binding Customers}" >
<ListBox.Resources>
<DataTemplate DataType="{x:Type MyApplication:Customers}">
<Label Grid.Row="0" Content="{Binding Customer.name}" FontSize="14" FontWeight="Bold" Padding="5" />
<Label Grid.Row="1" Grid.Column="0" Content="{Binding Customer.telephone}" Padding="10,5" />
</Grid>
</Grid>
</DataTemplate>
</ListBox.Resources>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
详细视图Usercontrol(迄今为止)
<Grid x:Name="containingGrid" DataContext="{Binding ElementName=lstCustomers, Path=SelectedItem}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Customer.name}" FontSize="23"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
谢谢格雷格