浏览文件
SettingPanelMultiItem.xaml
81 行 · 4.8 KB历史下载| 1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | xmlns:local="clr-namespace:UI.Controls.SettingPanel" |
| 4 | xmlns:base="clr-namespace:UI.Controls.Base" |
| 5 | xmlns:btn="clr-namespace:UI.Controls.Button" |
| 6 | xmlns:exp="clr-namespace:UI.Controls.Expander"> |
| 7 | <Style TargetType="{x:Type local:SettingPanelMultiItem}"> |
| 8 | <Setter Property="SnapsToDevicePixels" |
| 9 | Value="true" /> |
| 10 | <Setter Property="Margin" Value="0,0,0,20"/> |
| 11 | <Setter Property="Template"> |
| 12 | <Setter.Value> |
| 13 | <ControlTemplate TargetType="{x:Type local:SettingPanelMultiItem}"> |
| 14 | <Border Background="Transparent" x:Name="Border" CornerRadius="6" > |
| 15 | <exp:Expander Header="{TemplateBinding Title}" IsExpanded="True"> |
| 16 | <Grid> |
| 17 | <Grid.RowDefinitions> |
| 18 | <RowDefinition Height="auto"/> |
| 19 | <RowDefinition Height="auto"/> |
| 20 | </Grid.RowDefinitions> |
| 21 | <StackPanel x:Name="Container"> |
| 22 | </StackPanel> |
| 23 | |
| 24 | <btn:Button Margin="0,10" Grid.Row="1" Content="删除此项" Icon="Delete" Width="80" Background="#f51837" Foreground="White" Command="{TemplateBinding OnRemoveAction}"/> |
| 25 | </Grid> |
| 26 | |
| 27 | </exp:Expander> |
| 28 | <!--<Grid.RowDefinitions> |
| 29 | <RowDefinition Height="auto"/> |
| 30 | <RowDefinition Height="*"/> |
| 31 | |
| 32 | </Grid.RowDefinitions> |
| 33 | <Grid Margin="10,10,10,10"> |
| 34 | <TextBlock Text="{TemplateBinding Title}" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="16" FontWeight="Bold"/> |
| 35 | |
| 36 | <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center"> |
| 37 | <btn:IconButton ToolTip="收起" x:Name="FoldBtn" FontSize="14" Command="{TemplateBinding OnFoldAction}" Icon="ChevronUp" Margin="0"></btn:IconButton> |
| 38 | <btn:IconButton Icon="Delete" FontSize="14" Command="{TemplateBinding OnRemoveAction}" ToolTip="移除此项"></btn:IconButton> |
| 39 | </StackPanel> |
| 40 | |
| 41 | </Grid> |
| 42 | <StackPanel x:Name="Container" Grid.Row="1"> |
| 43 | <StackPanel.RenderTransform> |
| 44 | <ScaleTransform ScaleX="1" ScaleY="0"/> |
| 45 | </StackPanel.RenderTransform> |
| 46 | </StackPanel>--> |
| 47 | </Border> |
| 48 | <ControlTemplate.Triggers> |
| 49 | <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Fold}" Value="True"> |
| 50 | <!--<DataTrigger.EnterActions> |
| 51 | <BeginStoryboard> |
| 52 | <Storyboard> |
| 53 | <DoubleAnimation Storyboard.TargetProperty="(Border.Height)" |
| 54 | Storyboard.TargetName="Border" Duration="00:00:0.2" To="100"/> |
| 55 | </Storyboard> |
| 56 | </BeginStoryboard> |
| 57 | </DataTrigger.EnterActions>--> |
| 58 | <!--<DataTrigger.ExitActions> |
| 59 | <BeginStoryboard> |
| 60 | <Storyboard> |
| 61 | <DoubleAnimation Storyboard.TargetProperty="(ContentPresenter.RenderTransform). |
| 62 | (ScaleTransform.ScaleY)" |
| 63 | Storyboard.TargetName="Container" Duration="00:00:0.2" To="0"/> |
| 64 | </Storyboard> |
| 65 | </BeginStoryboard> |
| 66 | </DataTrigger.ExitActions>--> |
| 67 | </DataTrigger> |
| 68 | <!--<Trigger Property="Fold" |
| 69 | Value="True"> |
| 70 | <Setter TargetName="Container" Property="Visibility" Value="Collapsed"/> |
| 71 | </Trigger> |
| 72 | <Trigger Property="Fold" |
| 73 | Value="False"> |
| 74 | <Setter TargetName="Container" Property="Visibility" Value="Visible"/> |
| 75 | </Trigger>--> |
| 76 | </ControlTemplate.Triggers> |
| 77 | </ControlTemplate> |
| 78 | </Setter.Value> |
| 79 | </Setter> |
| 80 | </Style> |
| 81 | </ResourceDictionary> |

