RightCardControl.xaml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  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. Margin="10"
  151. VirtualizingPanel.VirtualizationMode="Recycling"
  152. VirtualizingPanel.IsVirtualizing="True"
  153. VirtualizingPanel.IsContainerVirtualizable="True"
  154. >
  155. <UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
  156. <!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
  157. <ListBox x:Name="IconListBox"
  158. ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
  159. BorderThickness="0"
  160. Padding="0,10,0,0"
  161. ScrollViewer.CanContentScroll ="False"
  162. >
  163. <ListBox.Template>
  164. <ControlTemplate TargetType="ListBox">
  165. <hc:ScrollViewer x:Name="WrapScroll"
  166. Orientation="Vertical"
  167. HorizontalScrollBarVisibility="Hidden"
  168. VerticalScrollBarVisibility="Auto"
  169. IsInertiaEnabled="True"
  170. CanContentScroll="True"
  171. PreviewMouseWheel="IconListBox_MouseWheel"
  172. >
  173. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
  174. <ItemsPresenter/>
  175. </Border>
  176. </hc:ScrollViewer>
  177. </ControlTemplate>
  178. </ListBox.Template>
  179. <ListBox.Background>
  180. <SolidColorBrush Color="#00FFFFFF" />
  181. </ListBox.Background>
  182. <ListBox.ItemsPanel>
  183. <ItemsPanelTemplate>
  184. <!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
  185. ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  186. ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  187. HorizontalAlignment="Center"
  188. SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>-->
  189. <WrapPanel Background="#00FFFFFF"
  190. Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
  191. Converter={StaticResource GetWidthByWWConvert},
  192. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
  193. />
  194. </ItemsPanelTemplate>
  195. </ListBox.ItemsPanel>
  196. <ListBox.Resources>
  197. <ContextMenu x:Key="IconDialog" Width="200">
  198. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  199. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  200. <MenuItem Header="添加URL项目" Click="AddUrlIcon" />
  201. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  202. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  203. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  204. <MenuItem Header="从列表移除" Click="RemoveIcon" 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.ItemTemplate>
  213. <DataTemplate>
  214. <hc:SimpleStackPanel Tag="{Binding}"
  215. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  216. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  217. HorizontalAlignment="Center"
  218. Background="#00FFFFFF"
  219. MouseEnter="MenuIcon_MouseEnter"
  220. MouseLeave="MenuIcon_MouseLeave"
  221. MouseMove="MenuIcon_MouseMove"
  222. MouseLeftButtonDown="Icon_MouseLeftButtonDown"
  223. MouseLeftButtonUp="Icon_MouseLeftButtonUp"
  224. >
  225. <!--<StackPanel Background="#00FFFFFF"
  226. MouseEnter="CursorPanel_MouseEnter"
  227. MouseLeave="CursorPanel_MouseLeave"
  228. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
  229. <Image Style="{StaticResource ImageStyle}"
  230. RenderOptions.BitmapScalingMode="HighQuality"/>
  231. <TextBlock MaxWidth="80"
  232. Margin="0,5,0,0"
  233. MaxHeight="40"
  234. FontSize="13"
  235. TextWrapping="Wrap"
  236. TextTrimming="WordEllipsis"
  237. TextAlignment="Center"
  238. VerticalAlignment="Center"
  239. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  240. Text="{Binding Name}"/>
  241. <!--</StackPanel>-->
  242. </hc:SimpleStackPanel>
  243. </DataTemplate>
  244. </ListBox.ItemTemplate>
  245. </ListBox>
  246. <!--</hc:TransitioningContentControl>-->
  247. </UniformGrid>
  248. </WrapPanel>
  249. </Grid>
  250. </hc:DialogContainer>
  251. </hc:Card>
  252. <hc:Card x:Name="VerticalCard"
  253. Visibility="Hidden"
  254. BorderThickness="1"
  255. Effect="{DynamicResource EffectShadow2}"
  256. Margin="5,0,5,5" Grid.ColumnSpan="2"
  257. MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown"
  258. >
  259. <hc:Card.Background>
  260. <SolidColorBrush Color="AliceBlue"
  261. hc:GeometryEffect.GeometryEffect="20"
  262. Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  263. </hc:Card.Background>
  264. <hc:Card.BorderBrush>
  265. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  266. </hc:Card.BorderBrush>
  267. <Grid>
  268. <WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
  269. VirtualizingPanel.IsVirtualizing="True"
  270. VirtualizingPanel.IsContainerVirtualizable="True"
  271. Margin="10"
  272. >
  273. <UniformGrid x:Name="VerticalUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, OffsetY= -10, Event=Visibility}">
  274. <!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
  275. <ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
  276. BorderThickness="0"
  277. Padding="0,10,0,0"
  278. x:Name="SearchListBox"
  279. SelectionChanged="SearchListBox_SelectionChanged"
  280. >
  281. <ListBox.Template>
  282. <ControlTemplate TargetType="ListBox">
  283. <hc:ScrollViewer Orientation="Vertical"
  284. HorizontalScrollBarVisibility="Hidden"
  285. VerticalScrollBarVisibility="Auto"
  286. IsInertiaEnabled="True"
  287. CanContentScroll="True"
  288. PreviewMouseWheel="VerticalIconList_PreviewMouseWheel"
  289. >
  290. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
  291. <ItemsPresenter/>
  292. </Border>
  293. </hc:ScrollViewer>
  294. </ControlTemplate>
  295. </ListBox.Template>
  296. <ListBox.Background>
  297. <SolidColorBrush Opacity="0"/>
  298. </ListBox.Background>
  299. <ListBox.Resources>
  300. <ContextMenu x:Key="IconDialog" Width="200">
  301. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  302. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  303. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  304. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  305. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  306. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  307. </ContextMenu>
  308. </ListBox.Resources>
  309. <ListBox.ItemContainerStyle>
  310. <Style TargetType="ListBoxItem" BasedOn="{StaticResource SearchListBoxItemStyle}">
  311. <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
  312. </Style>
  313. </ListBox.ItemContainerStyle>
  314. <ListBox.ItemsPanel>
  315. <ItemsPanelTemplate>
  316. <StackPanel Background="#00FFFFFF"
  317. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
  318. Converter={StaticResource GetWidthByWWConvert},
  319. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
  320. />
  321. </ItemsPanelTemplate>
  322. </ListBox.ItemsPanel>
  323. <ListBox.ItemTemplate>
  324. <DataTemplate>
  325. <Border CornerRadius="8">
  326. <Border.Style>
  327. <Style TargetType="Border">
  328. <Setter Property="VerticalAlignment" Value="Center"/>
  329. <Style.Triggers>
  330. <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem }}}"
  331. Value="True">
  332. <Setter Property="Background">
  333. <Setter.Value>
  334. <SolidColorBrush Color="White" Opacity="0.68"/>
  335. </Setter.Value>
  336. </Setter>
  337. </DataTrigger>
  338. </Style.Triggers>
  339. </Style>
  340. </Border.Style>
  341. <WrapPanel Tag="{Binding}"
  342. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
  343. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
  344. Converter={StaticResource GetWidthByWWConvert},
  345. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF}}"
  346. HorizontalAlignment="Left"
  347. VerticalAlignment="Center"
  348. hc:Poptip.HitMode="None"
  349. hc:Poptip.Placement="BottomLeft"
  350. Background="#00FFFFFF"
  351. MouseEnter="SearchIcon_MouseEnter"
  352. MouseLeave="SearchIcon_MouseLeave"
  353. MouseLeftButtonDown="Icon_MouseLeftButtonDown"
  354. MouseLeftButtonUp="Icon_MouseLeftButtonUp"
  355. MouseMove="SearchIcon_MouseMove"
  356. Margin="25,10,0,10"
  357. >
  358. <Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
  359. <TextBlock
  360. Margin="10,5,0,0"
  361. MaxHeight="40"
  362. FontSize="13"
  363. TextWrapping="Wrap"
  364. TextTrimming="WordEllipsis"
  365. TextAlignment="Left"
  366. VerticalAlignment="Center"
  367. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  368. Text="{Binding Name}"/>
  369. </WrapPanel>
  370. </Border>
  371. </DataTemplate>
  372. </ListBox.ItemTemplate>
  373. </ListBox>
  374. <!--</hc:TransitioningContentControl>-->
  375. </UniformGrid>
  376. </WrapPanel>
  377. </Grid>
  378. </hc:Card>
  379. </Grid>
  380. </UserControl>