Browse Source

搜索增加动画过渡

liufei 3 năm trước cách đây
mục cha
commit
00657550b2
2 tập tin đã thay đổi với 39 bổ sung36 xóa
  1. 37 36
      Control/UserControls/PannelCard/RightCardControl.xaml
  2. 2 0
      MainWindow.xaml.cs

+ 37 - 36
Control/UserControls/PannelCard/RightCardControl.xaml

@@ -175,43 +175,44 @@
                    VirtualizingPanel.IsVirtualizing="True"  
                    VirtualizingPanel.IsContainerVirtualizable="True"
                    >
-                    <hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom1Transition}">
-                        <ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}" 
+                    <UniformGrid x:Name="VerticalUFG">
+                        <hc:TransitioningContentControl TransitionMode="Fade">
+                            <ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}" 
                              BorderThickness="0"
                              Padding="0,10,0,0"
                              >
-                            <ListBox.Background>
-                                <SolidColorBrush Opacity="0"/>
-                            </ListBox.Background>
+                                <ListBox.Background>
+                                    <SolidColorBrush Opacity="0"/>
+                                </ListBox.Background>
 
-                            <ListBox.Resources>
-                                <ContextMenu x:Key="IconDialog" Width="200">
-                                    <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
-                                    <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
-                                    <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
-                                    <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
-                                    <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
-                                    <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
-                                </ContextMenu>
-                            </ListBox.Resources>
+                                <ListBox.Resources>
+                                    <ContextMenu x:Key="IconDialog" Width="200">
+                                        <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
+                                        <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
+                                        <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
+                                        <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
+                                        <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
+                                        <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
+                                    </ContextMenu>
+                                </ListBox.Resources>
 
-                            <ListBox.ItemContainerStyle>
-                                <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
-                                    <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
-                                </Style>
-                            </ListBox.ItemContainerStyle>
+                                <ListBox.ItemContainerStyle>
+                                    <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
+                                        <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
+                                    </Style>
+                                </ListBox.ItemContainerStyle>
 
-                            <ListBox.ItemsPanel>
-                                <ItemsPanelTemplate>
-                                    <StackPanel Background="#00FFFFFF"
+                                <ListBox.ItemsPanel>
+                                    <ItemsPanelTemplate>
+                                        <StackPanel Background="#00FFFFFF"
                                             Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=1}"
                                             />
-                                </ItemsPanelTemplate>
-                            </ListBox.ItemsPanel>
+                                    </ItemsPanelTemplate>
+                                </ListBox.ItemsPanel>
 
-                            <ListBox.ItemTemplate>
-                                <DataTemplate>
-                                    <WrapPanel Tag="{Binding}"
+                                <ListBox.ItemTemplate>
+                                    <DataTemplate>
+                                        <WrapPanel Tag="{Binding}"
                                            Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}" 
                                            Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}" 
                                            HorizontalAlignment="Left"
@@ -224,8 +225,8 @@
                                            MouseLeftButtonUp="Icon_MouseLeftButtonUp"
                                            Margin="25,20,0,0"
                                            >
-                                        <Image Style="{StaticResource ImageStyle}"  RenderOptions.BitmapScalingMode="HighQuality"/>
-                                        <TextBlock
+                                            <Image Style="{StaticResource ImageStyle}"  RenderOptions.BitmapScalingMode="HighQuality"/>
+                                            <TextBlock
                                            Margin="10,5,0,0"
                                            MaxHeight="40"
                                            FontSize="13"
@@ -235,13 +236,13 @@
                                            VerticalAlignment="Center" 
                                            Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
                                            Text="{Binding Name}"/>
-                                    </WrapPanel>
-                                </DataTemplate>
-                            </ListBox.ItemTemplate>
-                        </ListBox>
-                    </hc:TransitioningContentControl>
-                    
+                                        </WrapPanel>
+                                    </DataTemplate>
+                                </ListBox.ItemTemplate>
+                            </ListBox>
 
+                        </hc:TransitioningContentControl>
+                    </UniformGrid>
                 </WrapPanel>
 
             </Grid>

+ 2 - 0
MainWindow.xaml.cs

@@ -74,6 +74,7 @@ namespace GeekDesk
         private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
         {
             string inputText = SearchBox.Text.ToLower();
+            RightCard.VerticalUFG.Visibility = Visibility.Collapsed;
             if (!string.IsNullOrEmpty(inputText))
             {
                 SearchIconList.IconList.Clear();
@@ -95,6 +96,7 @@ namespace GeekDesk
             {
                 SearchIconList.IconList.Clear();
             }
+            RightCard.VerticalUFG.Visibility = Visibility.Visible;
         }
 
         public void HidedSearchBox()