RightCardControl.xaml 20 KB

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