RightCardControl.xaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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:cst="clr-namespace:GeekDesk.Constant"
  10. xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
  11. xmlns:component="clr-namespace:GeekDesk.CustomComponent.VirtualizingWrapPanel"
  12. xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
  13. xmlns:ot="clr-namespace:GeekDesk.Control.Other"
  14. mc:Ignorable="d"
  15. d:DesignHeight="450" d:DesignWidth="800"
  16. >
  17. <UserControl.Resources>
  18. <!--右侧栏样式动画-->
  19. <!--<Style x:Key="PanelStyle" TargetType="hc:SimpleStackPanel">
  20. <Style.Triggers>
  21. <Trigger Property="IsMouseOver" Value="true">
  22. <Setter Property="Cursor" Value="Hand"/>
  23. </Trigger>
  24. </Style.Triggers>
  25. </Style>-->
  26. <Style x:Key="ImageStyle" TargetType="Image">
  27. <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
  28. <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
  29. <Setter Property="Source" Value="{Binding BitmapImage}"/>
  30. </Style>
  31. <Style x:Key="ImageStyleNoWrite" TargetType="Image">
  32. <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
  33. <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
  34. <Setter Property="Source" Value="{Binding BitmapImage_NoWrite}"/>
  35. </Style>
  36. <Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
  37. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  38. <Setter Property="Template">
  39. <Setter.Value>
  40. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  41. <Border>
  42. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  43. </Border>
  44. </ControlTemplate>
  45. </Setter.Value>
  46. </Setter>
  47. </Style>
  48. <Style x:Key="SearchListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
  49. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  50. <Setter Property="VerticalAlignment" Value="Center"/>
  51. <Setter Property="Template">
  52. <Setter.Value>
  53. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  54. <Border>
  55. <Border.Style>
  56. <Style TargetType="Border">
  57. <Setter Property="VerticalAlignment" Value="Center"/>
  58. </Style>
  59. </Border.Style>
  60. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  61. </Border>
  62. </ControlTemplate>
  63. </Setter.Value>
  64. </Setter>
  65. </Style>
  66. <Style x:Key="MyPoptipStyle" TargetType="Border">
  67. <Setter Property="HorizontalAlignment" Value="Center"/>
  68. <Setter Property="VerticalAlignment" Value="Center"/>
  69. <Setter Property="BorderThickness" Value="1"/>
  70. <Setter Property="Background" Value="White"/>
  71. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  72. <Setter Property="CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
  73. <Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
  74. <!--<Setter Property="Template">
  75. <Setter.Value>
  76. <ControlTemplate TargetType="hc:Poptip">
  77. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
  78. <ContentPresenter Margin="{TemplateBinding Padding}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
  79. </Border>
  80. </ControlTemplate>
  81. </Setter.Value>
  82. </Setter>-->
  83. </Style>
  84. <Storyboard x:Key="Custom1Transition1" x:Shared="False">
  85. <DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
  86. <DoubleAnimation.EasingFunction>
  87. <ElasticEase Oscillations="1"/>
  88. </DoubleAnimation.EasingFunction>
  89. </DoubleAnimation>
  90. </Storyboard>
  91. <Storyboard x:Key="Custom2Transition2" x:Shared="False">
  92. <DoubleAnimation From="10" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
  93. <DoubleAnimation.EasingFunction>
  94. <ElasticEase Oscillations="1"/>
  95. </DoubleAnimation.EasingFunction>
  96. </DoubleAnimation>
  97. </Storyboard>
  98. <Storyboard x:Key="Custom3Transition3" x:Shared="False">
  99. <DoubleAnimation From=".8" To="1" Duration="0:0:0.4">
  100. <DoubleAnimation.EasingFunction>
  101. <ElasticEase Oscillations="1"/>
  102. </DoubleAnimation.EasingFunction>
  103. </DoubleAnimation>
  104. </Storyboard>
  105. <cvt:OpcityConvert x:Key="OpcityConvert"/>
  106. <cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
  107. <temp:SearchIconList x:Key="SearchIconList"/>
  108. </UserControl.Resources>
  109. <!--右侧栏-->
  110. <Grid>
  111. <Popup Name="MyPoptip" FlowDirection="LeftToRight"
  112. PopupAnimation="None" Placement="Mouse"
  113. IsOpen="False"
  114. AllowsTransparency="True"
  115. >
  116. <Grid Background="Transparent">
  117. <Border Style="{StaticResource MyPoptipStyle}">
  118. <TextBlock Name="MyPoptipContent" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Left" Text="Test" FontSize="13"/>
  119. </Border>
  120. </Grid>
  121. </Popup>
  122. <hc:Card AllowDrop="True"
  123. x:Name="WrapCard"
  124. Visibility="Visible"
  125. Drop="Wrap_Drop"
  126. BorderThickness="1"
  127. Effect="{DynamicResource EffectShadow2}"
  128. Margin="5,0,5,5" Grid.ColumnSpan="2"
  129. PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown"
  130. hc:Dialog.Token="RightWrapCardDialog"
  131. MouseWheel="IconListBox_MouseWheel"
  132. >
  133. <hc:Card.Background>
  134. <SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  135. </hc:Card.Background>
  136. <hc:Card.BorderBrush>
  137. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  138. </hc:Card.BorderBrush>
  139. <hc:Card.ContextMenu>
  140. <ContextMenu Width="200">
  141. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  142. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  143. <MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
  144. </ContextMenu>
  145. </hc:Card.ContextMenu>
  146. <hc:DialogContainer>
  147. <Grid>
  148. <ot:PasswordDialog xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility, Duration=50, Delay=0}"
  149. x:Name="PDDialog"
  150. Visibility="Collapsed"
  151. Panel.ZIndex="99"
  152. IsVisibleChanged="PDDialog_IsVisibleChanged"
  153. Margin="0,-100,0,0"/>
  154. <StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
  155. <WrapPanel Orientation="Horizontal"
  156. Margin="10"
  157. >
  158. <UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
  159. <!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
  160. <ListBox x:Name="IconListBox"
  161. ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
  162. BorderThickness="0"
  163. Padding="0,10,0,0"
  164. ScrollViewer.CanContentScroll ="True"
  165. VirtualizingPanel.VirtualizationMode="Recycling"
  166. VirtualizingPanel.IsVirtualizing="True"
  167. VirtualizingPanel.IsContainerVirtualizable="True"
  168. VirtualizingPanel.ScrollUnit="Pixel"
  169. >
  170. <ListBox.Template>
  171. <ControlTemplate TargetType="ListBox">
  172. <hc:ScrollViewer x:Name="WrapScroll"
  173. HorizontalScrollBarVisibility="Hidden"
  174. VerticalScrollBarVisibility="Auto"
  175. IsInertiaEnabled="True"
  176. CanContentScroll="True"
  177. PreviewMouseWheel="IconListBox_MouseWheel"
  178. >
  179. <Border BorderBrush="{TemplateBinding BorderBrush}"
  180. BorderThickness="{TemplateBinding BorderBrush}"
  181. Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
  182. Converter={StaticResource GetWidthByWWConvert},
  183. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_40}}"
  184. >
  185. <ItemsPresenter/>
  186. </Border>
  187. </hc:ScrollViewer>
  188. </ControlTemplate>
  189. </ListBox.Template>
  190. <ListBox.Background>
  191. <SolidColorBrush Color="#00FFFFFF" />
  192. </ListBox.Background>
  193. <ListBox.ItemsPanel>
  194. <ItemsPanelTemplate>
  195. <!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
  196. ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  197. ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  198. HorizontalAlignment="Center"
  199. SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>-->
  200. <component:VirtualizingWrapPanel VirtualizationMode="Recycling"
  201. IsVirtualizing="True"
  202. IsContainerVirtualizable="True"
  203. VirtualizingPanel.ScrollUnit="Pixel"
  204. Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
  205. Converter={StaticResource GetWidthByWWConvert},
  206. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_40}}"
  207. />
  208. </ItemsPanelTemplate>
  209. </ListBox.ItemsPanel>
  210. <ListBox.Resources>
  211. <ContextMenu x:Key="IconDialog" Width="200">
  212. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  213. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  214. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  215. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  216. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  217. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  218. <MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
  219. </ContextMenu>
  220. </ListBox.Resources>
  221. <ListBox.ItemContainerStyle>
  222. <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
  223. <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
  224. </Style>
  225. </ListBox.ItemContainerStyle>
  226. <ListBox.ItemTemplate>
  227. <DataTemplate>
  228. <hc:SimpleStackPanel Tag="{Binding}"
  229. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  230. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  231. HorizontalAlignment="Center"
  232. Background="#00FFFFFF"
  233. MouseEnter="MenuIcon_MouseEnter"
  234. MouseLeave="MenuIcon_MouseLeave"
  235. MouseMove="MenuIcon_MouseMove"
  236. MouseLeftButtonDown="Icon_MouseLeftButtonDown"
  237. MouseLeftButtonUp="Icon_MouseLeftButtonUp"
  238. >
  239. <!--<StackPanel Background="#00FFFFFF"
  240. MouseEnter="CursorPanel_MouseEnter"
  241. MouseLeave="CursorPanel_MouseLeave"
  242. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
  243. <Image Style="{StaticResource ImageStyle}"
  244. RenderOptions.BitmapScalingMode="HighQuality"/>
  245. <TextBlock MaxWidth="80"
  246. Margin="0,5,0,0"
  247. MaxHeight="40"
  248. FontSize="13"
  249. TextWrapping="Wrap"
  250. TextTrimming="WordEllipsis"
  251. TextAlignment="Center"
  252. VerticalAlignment="Center"
  253. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  254. Text="{Binding Name}"/>
  255. <!--</StackPanel>-->
  256. </hc:SimpleStackPanel>
  257. </DataTemplate>
  258. </ListBox.ItemTemplate>
  259. </ListBox>
  260. <!--</hc:TransitioningContentControl>-->
  261. </UniformGrid>
  262. </WrapPanel>
  263. </Grid>
  264. </hc:DialogContainer>
  265. </hc:Card>
  266. <hc:Card x:Name="VerticalCard"
  267. Visibility="Visible"
  268. BorderThickness="1"
  269. Effect="{DynamicResource EffectShadow2}"
  270. Margin="5,0,5,5" Grid.ColumnSpan="2"
  271. MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown"
  272. >
  273. <hc:Card.Background>
  274. <SolidColorBrush Color="AliceBlue"
  275. hc:GeometryEffect.GeometryEffect="20"
  276. Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  277. </hc:Card.Background>
  278. <hc:Card.BorderBrush>
  279. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  280. </hc:Card.BorderBrush>
  281. </hc:Card>
  282. <hc:LoadingCircle x:Name="Loading_RightCard"
  283. Width="45" Height="45"
  284. DotBorderBrush="White"
  285. DotBorderThickness="2"
  286. Foreground="DarkGray"
  287. Opacity="0.8"
  288. DotDiameter="10"
  289. Margin="-50,-150,0,0"
  290. Visibility="Collapsed"/>
  291. </Grid>
  292. </UserControl>