RightCardControl.xaml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
  12. xmlns:ot="clr-namespace:GeekDesk.Control.Other"
  13. xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
  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="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
  32. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  33. <Setter Property="Template">
  34. <Setter.Value>
  35. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  36. <Border>
  37. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  38. </Border>
  39. </ControlTemplate>
  40. </Setter.Value>
  41. </Setter>
  42. </Style>
  43. <Style x:Key="SearchListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
  44. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  45. <Setter Property="VerticalAlignment" Value="Center"/>
  46. <Setter Property="Template">
  47. <Setter.Value>
  48. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  49. <Border>
  50. <Border.Style>
  51. <Style TargetType="Border">
  52. <Setter Property="VerticalAlignment" Value="Center"/>
  53. </Style>
  54. </Border.Style>
  55. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  56. </Border>
  57. </ControlTemplate>
  58. </Setter.Value>
  59. </Setter>
  60. </Style>
  61. <Style x:Key="MyPoptipStyle" TargetType="Border">
  62. <Setter Property="HorizontalAlignment" Value="Center"/>
  63. <Setter Property="VerticalAlignment" Value="Center"/>
  64. <Setter Property="BorderThickness" Value="1"/>
  65. <Setter Property="Background" Value="White"/>
  66. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  67. <Setter Property="CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
  68. <Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
  69. <!--<Setter Property="Template">
  70. <Setter.Value>
  71. <ControlTemplate TargetType="hc:Poptip">
  72. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
  73. <ContentPresenter Margin="{TemplateBinding Padding}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
  74. </Border>
  75. </ControlTemplate>
  76. </Setter.Value>
  77. </Setter>-->
  78. </Style>
  79. <Storyboard x:Key="Custom1Transition1" x:Shared="False">
  80. <DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
  81. <DoubleAnimation.EasingFunction>
  82. <ElasticEase Oscillations="1"/>
  83. </DoubleAnimation.EasingFunction>
  84. </DoubleAnimation>
  85. </Storyboard>
  86. <Storyboard x:Key="Custom2Transition2" x:Shared="False">
  87. <DoubleAnimation From="10" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
  88. <DoubleAnimation.EasingFunction>
  89. <ElasticEase Oscillations="1"/>
  90. </DoubleAnimation.EasingFunction>
  91. </DoubleAnimation>
  92. </Storyboard>
  93. <Storyboard x:Key="Custom3Transition3" x:Shared="False">
  94. <DoubleAnimation From=".8" To="1" Duration="0:0:0.4">
  95. <DoubleAnimation.EasingFunction>
  96. <ElasticEase Oscillations="1"/>
  97. </DoubleAnimation.EasingFunction>
  98. </DoubleAnimation>
  99. </Storyboard>
  100. <cvt:OpcityConvert x:Key="OpcityConvert"/>
  101. <cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
  102. <temp:SearchIconList x:Key="SearchIconList"/>
  103. </UserControl.Resources>
  104. <!--右侧栏-->
  105. <Grid>
  106. <Popup Name="MyPoptip" FlowDirection="LeftToRight"
  107. PopupAnimation="None" Placement="Mouse"
  108. IsOpen="False"
  109. AllowsTransparency="True"
  110. >
  111. <Grid Background="Transparent">
  112. <Border Style="{StaticResource MyPoptipStyle}">
  113. <TextBlock Name="MyPoptipContent" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Left" Text="Test" FontSize="13"/>
  114. </Border>
  115. </Grid>
  116. </Popup>
  117. <hc:Card AllowDrop="True"
  118. x:Name="WrapCard"
  119. Visibility="Visible"
  120. Drop="Wrap_Drop"
  121. BorderThickness="1"
  122. Effect="{DynamicResource EffectShadow2}"
  123. Margin="5,0,5,5" Grid.ColumnSpan="2"
  124. PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown"
  125. hc:Dialog.Token="RightWrapCardDialog"
  126. MouseWheel="IconListBox_MouseWheel"
  127. >
  128. <hc:Card.Background>
  129. <SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  130. </hc:Card.Background>
  131. <hc:Card.BorderBrush>
  132. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  133. </hc:Card.BorderBrush>
  134. <hc:Card.ContextMenu>
  135. <ContextMenu Width="200">
  136. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  137. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  138. <MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
  139. </ContextMenu>
  140. </hc:Card.ContextMenu>
  141. <hc:DialogContainer>
  142. <Grid>
  143. <ot:PasswordDialog xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility, Duration=50, Delay=0}"
  144. x:Name="PDDialog"
  145. Panel.ZIndex="99"
  146. IsVisibleChanged="PDDialog_IsVisibleChanged"
  147. Margin="0,-100,0,0"/>
  148. <StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
  149. <WrapPanel Orientation="Horizontal"
  150. VirtualizingPanel.VirtualizationMode="Recycling"
  151. VirtualizingPanel.IsVirtualizing="True"
  152. VirtualizingPanel.IsContainerVirtualizable="True"
  153. >
  154. <UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
  155. <!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
  156. <ListBox x:Name="IconListBox"
  157. ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
  158. BorderThickness="0"
  159. Padding="0,10,0,0"
  160. ScrollViewer.CanContentScroll ="False"
  161. >
  162. <ListBox.Template>
  163. <ControlTemplate TargetType="ListBox">
  164. <hc:ScrollViewer x:Name="WrapScroll"
  165. Orientation="Vertical"
  166. HorizontalScrollBarVisibility="Hidden"
  167. VerticalScrollBarVisibility="Auto"
  168. IsInertiaEnabled="True"
  169. CanContentScroll="True"
  170. PreviewMouseWheel="IconListBox_MouseWheel"
  171. >
  172. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
  173. <ItemsPresenter/>
  174. </Border>
  175. </hc:ScrollViewer>
  176. </ControlTemplate>
  177. </ListBox.Template>
  178. <ListBox.Background>
  179. <SolidColorBrush Color="#00FFFFFF" />
  180. </ListBox.Background>
  181. <ListBox.ItemsPanel>
  182. <ItemsPanelTemplate>
  183. <!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
  184. ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  185. ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  186. HorizontalAlignment="Center"
  187. SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>-->
  188. <WrapPanel Background="#00FFFFFF"
  189. Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
  190. Converter={StaticResource GetWidthByWWConvert},
  191. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
  192. />
  193. </ItemsPanelTemplate>
  194. </ListBox.ItemsPanel>
  195. <ListBox.Resources>
  196. <ContextMenu x:Key="IconDialog" Width="200">
  197. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  198. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  199. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  200. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  201. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  202. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  203. <MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
  204. </ContextMenu>
  205. </ListBox.Resources>
  206. <ListBox.ItemContainerStyle>
  207. <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
  208. <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
  209. </Style>
  210. </ListBox.ItemContainerStyle>
  211. <ListBox.ItemTemplate>
  212. <DataTemplate>
  213. <hc:SimpleStackPanel Tag="{Binding}"
  214. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  215. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  216. HorizontalAlignment="Center"
  217. Background="#00FFFFFF"
  218. MouseEnter="MenuIcon_MouseEnter"
  219. MouseLeave="MenuIcon_MouseLeave"
  220. MouseMove="MenuIcon_MouseMove"
  221. MouseLeftButtonDown="Icon_MouseLeftButtonDown"
  222. MouseLeftButtonUp="Icon_MouseLeftButtonUp"
  223. >
  224. <!--<StackPanel Background="#00FFFFFF"
  225. MouseEnter="CursorPanel_MouseEnter"
  226. MouseLeave="CursorPanel_MouseLeave"
  227. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
  228. <Image Style="{StaticResource ImageStyle}"
  229. RenderOptions.BitmapScalingMode="HighQuality"/>
  230. <TextBlock MaxWidth="80"
  231. Margin="0,5,0,0"
  232. MaxHeight="40"
  233. FontSize="13"
  234. TextWrapping="Wrap"
  235. TextTrimming="WordEllipsis"
  236. TextAlignment="Center"
  237. VerticalAlignment="Center"
  238. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  239. Text="{Binding Name}"/>
  240. <!--</StackPanel>-->
  241. </hc:SimpleStackPanel>
  242. </DataTemplate>
  243. </ListBox.ItemTemplate>
  244. </ListBox>
  245. <!--</hc:TransitioningContentControl>-->
  246. </UniformGrid>
  247. </WrapPanel>
  248. </Grid>
  249. </hc:DialogContainer>
  250. </hc:Card>
  251. <hc:Card x:Name="VerticalCard"
  252. Visibility="Hidden"
  253. BorderThickness="1"
  254. Effect="{DynamicResource EffectShadow2}"
  255. Margin="5,0,5,5" Grid.ColumnSpan="2"
  256. MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown"
  257. >
  258. <hc:Card.Background>
  259. <SolidColorBrush Color="AliceBlue"
  260. hc:GeometryEffect.GeometryEffect="20"
  261. Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  262. </hc:Card.Background>
  263. <hc:Card.BorderBrush>
  264. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  265. </hc:Card.BorderBrush>
  266. <Grid>
  267. <WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
  268. VirtualizingPanel.IsVirtualizing="True"
  269. VirtualizingPanel.IsContainerVirtualizable="True"
  270. >
  271. <UniformGrid x:Name="VerticalUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, OffsetY= -10, Event=Visibility}">
  272. <!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
  273. <ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
  274. BorderThickness="0"
  275. Padding="0,10,0,0"
  276. x:Name="SearchListBox"
  277. SelectionChanged="SearchListBox_SelectionChanged"
  278. >
  279. <ListBox.Template>
  280. <ControlTemplate TargetType="ListBox">
  281. <hc:ScrollViewer Orientation="Vertical"
  282. HorizontalScrollBarVisibility="Hidden"
  283. VerticalScrollBarVisibility="Auto"
  284. IsInertiaEnabled="True"
  285. CanContentScroll="True"
  286. PreviewMouseWheel="VerticalIconList_PreviewMouseWheel"
  287. >
  288. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
  289. <ItemsPresenter/>
  290. </Border>
  291. </hc:ScrollViewer>
  292. </ControlTemplate>
  293. </ListBox.Template>
  294. <ListBox.Background>
  295. <SolidColorBrush Opacity="0"/>
  296. </ListBox.Background>
  297. <ListBox.Resources>
  298. <ContextMenu x:Key="IconDialog" Width="200">
  299. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  300. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  301. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  302. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  303. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  304. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  305. </ContextMenu>
  306. </ListBox.Resources>
  307. <ListBox.ItemContainerStyle>
  308. <Style TargetType="ListBoxItem" BasedOn="{StaticResource SearchListBoxItemStyle}">
  309. <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
  310. </Style>
  311. </ListBox.ItemContainerStyle>
  312. <ListBox.ItemsPanel>
  313. <ItemsPanelTemplate>
  314. <StackPanel Background="#00FFFFFF"
  315. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
  316. Converter={StaticResource GetWidthByWWConvert},
  317. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
  318. />
  319. </ItemsPanelTemplate>
  320. </ListBox.ItemsPanel>
  321. <ListBox.ItemTemplate>
  322. <DataTemplate>
  323. <Border CornerRadius="8">
  324. <Border.Style>
  325. <Style TargetType="Border">
  326. <Setter Property="VerticalAlignment" Value="Center"/>
  327. <Style.Triggers>
  328. <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem }}}"
  329. Value="True">
  330. <Setter Property="Background">
  331. <Setter.Value>
  332. <SolidColorBrush Color="White" Opacity="0.68"/>
  333. </Setter.Value>
  334. </Setter>
  335. </DataTrigger>
  336. </Style.Triggers>
  337. </Style>
  338. </Border.Style>
  339. <WrapPanel Tag="{Binding}"
  340. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
  341. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
  342. Converter={StaticResource GetWidthByWWConvert},
  343. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF}}"
  344. HorizontalAlignment="Left"
  345. VerticalAlignment="Center"
  346. hc:Poptip.HitMode="None"
  347. hc:Poptip.Placement="BottomLeft"
  348. Background="#00FFFFFF"
  349. MouseEnter="SearchIcon_MouseEnter"
  350. MouseLeave="SearchIcon_MouseLeave"
  351. MouseLeftButtonDown="Icon_MouseLeftButtonDown"
  352. MouseLeftButtonUp="Icon_MouseLeftButtonUp"
  353. MouseMove="SearchIcon_MouseMove"
  354. Margin="25,10,0,10"
  355. >
  356. <Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
  357. <TextBlock
  358. Margin="10,5,0,0"
  359. MaxHeight="40"
  360. FontSize="13"
  361. TextWrapping="Wrap"
  362. TextTrimming="WordEllipsis"
  363. TextAlignment="Left"
  364. VerticalAlignment="Center"
  365. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  366. Text="{Binding Name}"/>
  367. </WrapPanel>
  368. </Border>
  369. </DataTemplate>
  370. </ListBox.ItemTemplate>
  371. </ListBox>
  372. <!--</hc:TransitioningContentControl>-->
  373. </UniformGrid>
  374. </WrapPanel>
  375. </Grid>
  376. </hc:Card>
  377. </Grid>
  378. </UserControl>