RightCardControl.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <UserControl x:Class="GeekDesk.Control.UserControls.PannelCard.RightCardControl"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
  7. xmlns:hc="https://handyorg.github.io/handycontrol"
  8. xmlns:cvt="clr-namespace:GeekDesk.Converts"
  9. xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
  10. mc:Ignorable="d"
  11. d:DesignHeight="450" d:DesignWidth="800"
  12. >
  13. <UserControl.Resources>
  14. <!--右侧栏样式动画-->
  15. <!--<Style x:Key="PanelStyle" TargetType="hc:SimpleStackPanel">
  16. <Style.Triggers>
  17. <Trigger Property="IsMouseOver" Value="true">
  18. <Setter Property="Cursor" Value="Hand"/>
  19. </Trigger>
  20. </Style.Triggers>
  21. </Style>-->
  22. <Style x:Key="ImageStyle" TargetType="Image">
  23. <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
  24. <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
  25. <Setter Property="Source" Value="{Binding BitmapImage}"/>
  26. </Style>
  27. <Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
  28. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  29. <Setter Property="Template">
  30. <Setter.Value>
  31. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  32. <Border>
  33. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  34. </Border>
  35. </ControlTemplate>
  36. </Setter.Value>
  37. </Setter>
  38. </Style>
  39. <Storyboard x:Key="Custom1Transition1" x:Shared="False">
  40. <DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
  41. <DoubleAnimation.EasingFunction>
  42. <ElasticEase Oscillations="1"/>
  43. </DoubleAnimation.EasingFunction>
  44. </DoubleAnimation>
  45. </Storyboard>
  46. <Storyboard x:Key="Custom2Transition2" x:Shared="False">
  47. <DoubleAnimation From="10" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
  48. <DoubleAnimation.EasingFunction>
  49. <ElasticEase Oscillations="1"/>
  50. </DoubleAnimation.EasingFunction>
  51. </DoubleAnimation>
  52. </Storyboard>
  53. <Storyboard x:Key="Custom3Transition3" x:Shared="False">
  54. <DoubleAnimation From=".8" To="1" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
  55. <DoubleAnimation.EasingFunction>
  56. <ElasticEase Oscillations="1"/>
  57. </DoubleAnimation.EasingFunction>
  58. </DoubleAnimation>
  59. </Storyboard>
  60. <cvt:OpcityConvert x:Key="OpcityConvert"/>
  61. <cvt:SearchResWidth x:Key="SearchResWidth"/>
  62. <temp:SearchIconList x:Key="SearchIconList"/>
  63. </UserControl.Resources>
  64. <!--右侧栏-->
  65. <Grid>
  66. <hc:Card AllowDrop="True"
  67. x:Name="WrapCard"
  68. Visibility="Visible"
  69. Drop="Wrap_Drop"
  70. BorderThickness="1"
  71. Effect="{DynamicResource EffectShadow2}"
  72. Margin="5,0,5,5" Grid.ColumnSpan="2"
  73. PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown">
  74. <hc:Card.Background>
  75. <SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  76. </hc:Card.Background>
  77. <hc:Card.BorderBrush>
  78. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  79. </hc:Card.BorderBrush>
  80. <hc:Card.ContextMenu>
  81. <ContextMenu Width="200">
  82. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  83. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  84. <MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
  85. </ContextMenu>
  86. </hc:Card.ContextMenu>
  87. <Grid>
  88. <StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
  89. <WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
  90. VirtualizingPanel.IsVirtualizing="True"
  91. VirtualizingPanel.IsContainerVirtualizable="True"
  92. >
  93. <UniformGrid x:Name="WrapUFG">
  94. <hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">
  95. <ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
  96. BorderThickness="0"
  97. Padding="0,10,0,0"
  98. >
  99. <ListBox.Background>
  100. <SolidColorBrush Opacity="0"/>
  101. </ListBox.Background>
  102. <ListBox.ItemsPanel>
  103. <ItemsPanelTemplate>
  104. <!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
  105. ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  106. ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  107. HorizontalAlignment="Center"
  108. SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>-->
  109. <WrapPanel />
  110. </ItemsPanelTemplate>
  111. </ListBox.ItemsPanel>
  112. <ListBox.Resources>
  113. <ContextMenu x:Key="IconDialog" Width="200">
  114. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  115. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  116. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  117. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  118. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  119. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  120. <MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
  121. </ContextMenu>
  122. </ListBox.Resources>
  123. <ListBox.ItemContainerStyle>
  124. <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
  125. <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
  126. </Style>
  127. </ListBox.ItemContainerStyle>
  128. <ListBox.ItemTemplate>
  129. <DataTemplate>
  130. <hc:SimpleStackPanel Tag="{Binding}"
  131. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  132. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  133. HorizontalAlignment="Center"
  134. hc:Poptip.Content="{Binding Content}"
  135. hc:Poptip.Placement="BottomLeft"
  136. Background="#00FFFFFF"
  137. MouseEnter="StackPanel_MouseEnter"
  138. MouseLeave="StackPanel_MouseLeave"
  139. MouseLeftButtonDown="Icon_MouseLeftButtonDown"
  140. MouseLeftButtonUp="Icon_MouseLeftButtonUp"
  141. >
  142. <!--<StackPanel Background="#00FFFFFF"
  143. MouseEnter="CursorPanel_MouseEnter"
  144. MouseLeave="CursorPanel_MouseLeave"
  145. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
  146. <Image Style="{StaticResource ImageStyle}"
  147. RenderOptions.BitmapScalingMode="HighQuality"/>
  148. <TextBlock MaxWidth="80"
  149. Margin="0,5,0,0"
  150. MaxHeight="40"
  151. FontSize="13"
  152. TextWrapping="Wrap"
  153. TextTrimming="WordEllipsis"
  154. TextAlignment="Center"
  155. VerticalAlignment="Center"
  156. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  157. Text="{Binding Name}"/>
  158. <!--</StackPanel>-->
  159. </hc:SimpleStackPanel>
  160. </DataTemplate>
  161. </ListBox.ItemTemplate>
  162. </ListBox>
  163. </hc:TransitioningContentControl>
  164. </UniformGrid>
  165. </WrapPanel>
  166. </Grid>
  167. </hc:Card>
  168. <hc:Card x:Name="VerticalCard"
  169. Visibility="Hidden"
  170. BorderThickness="1"
  171. Effect="{DynamicResource EffectShadow2}"
  172. Margin="5,0,5,5" Grid.ColumnSpan="2"
  173. MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown"
  174. >
  175. <hc:Card.Background>
  176. <SolidColorBrush Color="AliceBlue"
  177. hc:GeometryEffect.GeometryEffect="20"
  178. Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  179. </hc:Card.Background>
  180. <hc:Card.BorderBrush>
  181. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  182. </hc:Card.BorderBrush>
  183. <Grid>
  184. <WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
  185. VirtualizingPanel.IsVirtualizing="True"
  186. VirtualizingPanel.IsContainerVirtualizable="True"
  187. >
  188. <UniformGrid x:Name="VerticalUFG">
  189. <hc:TransitioningContentControl TransitionMode="Left2RightWithFade">
  190. <ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
  191. BorderThickness="0"
  192. Padding="0,10,0,0"
  193. >
  194. <ListBox.Background>
  195. <SolidColorBrush Opacity="0"/>
  196. </ListBox.Background>
  197. <ListBox.Resources>
  198. <ContextMenu x:Key="IconDialog" Width="200">
  199. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  200. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  201. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  202. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  203. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  204. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  205. </ContextMenu>
  206. </ListBox.Resources>
  207. <ListBox.ItemContainerStyle>
  208. <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
  209. <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
  210. </Style>
  211. </ListBox.ItemContainerStyle>
  212. <ListBox.ItemsPanel>
  213. <ItemsPanelTemplate>
  214. <StackPanel Background="#00FFFFFF"
  215. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=1}"
  216. />
  217. </ItemsPanelTemplate>
  218. </ListBox.ItemsPanel>
  219. <ListBox.ItemTemplate>
  220. <DataTemplate>
  221. <WrapPanel Tag="{Binding}"
  222. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
  223. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}"
  224. HorizontalAlignment="Left"
  225. hc:Poptip.HitMode="None"
  226. hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
  227. hc:Poptip.Content="{Binding Content}"
  228. hc:Poptip.Placement="BottomLeft"
  229. Background="#00FFFFFF"
  230. MouseLeftButtonDown="Icon_MouseLeftButtonDown"
  231. MouseLeftButtonUp="Icon_MouseLeftButtonUp"
  232. Margin="25,20,0,0"
  233. >
  234. <Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
  235. <TextBlock
  236. Margin="10,5,0,0"
  237. MaxHeight="40"
  238. FontSize="13"
  239. TextWrapping="Wrap"
  240. TextTrimming="WordEllipsis"
  241. TextAlignment="Left"
  242. VerticalAlignment="Center"
  243. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  244. Text="{Binding Name}"/>
  245. </WrapPanel>
  246. </DataTemplate>
  247. </ListBox.ItemTemplate>
  248. </ListBox>
  249. </hc:TransitioningContentControl>
  250. </UniformGrid>
  251. </WrapPanel>
  252. </Grid>
  253. </hc:Card>
  254. </Grid>
  255. </UserControl>