1
0

RightCardControl.xaml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. <cvt:Boolean2VisibilityConverter x:Key="MyBoolean2VisibilityConverter"/>
  110. <cvt:ValueConvert x:Key="ValueConvert"/>
  111. <cst:RunTimeStatus x:Key="RunTimeStatus"/>
  112. <cst:DictConst x:Key="DictConst"/>
  113. </UserControl.Resources>
  114. <!--右侧栏-->
  115. <Grid>
  116. <Popup Name="MyPoptip" FlowDirection="LeftToRight"
  117. PopupAnimation="None" Placement="Mouse"
  118. IsOpen="False"
  119. AllowsTransparency="True"
  120. >
  121. <Grid Background="Transparent">
  122. <Border Style="{StaticResource MyPoptipStyle}">
  123. <TextBlock Name="MyPoptipContent" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Left" Text="Test" FontSize="13"/>
  124. </Border>
  125. </Grid>
  126. </Popup>
  127. <hc:Card AllowDrop="True"
  128. x:Name="WrapCard"
  129. Visibility="Visible"
  130. Drop="Wrap_Drop"
  131. BorderThickness="1"
  132. Effect="{DynamicResource EffectShadow2}"
  133. Margin="5,0,5,5" Grid.ColumnSpan="2"
  134. PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown"
  135. hc:Dialog.Token="RightWrapCardDialog"
  136. MouseWheel="IconListBox_MouseWheel"
  137. >
  138. <hc:Card.Background>
  139. <SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  140. </hc:Card.Background>
  141. <hc:Card.BorderBrush>
  142. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  143. </hc:Card.BorderBrush>
  144. <hc:Card.ContextMenu>
  145. <ContextMenu Width="200">
  146. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  147. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  148. <MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
  149. <MenuItem x:Name="showTitle" Header="隐藏/显示标题" Click="ShowTitle_Click"/>
  150. <MenuItem Header="{Binding AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource ValueConvert}, ConverterParameter={x:Static cst:DictConst.batchMenuHeaderDict}}" Click="BatchHandle" Tag="{Binding}"/>
  151. </ContextMenu>
  152. </hc:Card.ContextMenu>
  153. <hc:DialogContainer>
  154. <Grid>
  155. <ot:PasswordDialog xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility, Duration=50, Delay=0}"
  156. x:Name="PDDialog"
  157. Visibility="Collapsed"
  158. Panel.ZIndex="99"
  159. IsVisibleChanged="PDDialog_IsVisibleChanged"
  160. Margin="0,-100,0,0"/>
  161. <StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
  162. <WrapPanel Orientation="Horizontal"
  163. Margin="10"
  164. >
  165. <UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
  166. <!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
  167. <ListBox x:Name="IconListBox"
  168. ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
  169. BorderThickness="0"
  170. Padding="0,10,0,0"
  171. SelectionChanged="IconListBox_SelectionChanged"
  172. ScrollViewer.CanContentScroll ="True"
  173. VirtualizingPanel.VirtualizationMode="Recycling"
  174. VirtualizingPanel.IsVirtualizing="True"
  175. VirtualizingPanel.IsContainerVirtualizable="True"
  176. VirtualizingPanel.ScrollUnit="Pixel"
  177. >
  178. <ListBox.Template>
  179. <ControlTemplate TargetType="ListBox">
  180. <hc:ScrollViewer x:Name="WrapScroll"
  181. HorizontalScrollBarVisibility="Hidden"
  182. VerticalScrollBarVisibility="Auto"
  183. IsInertiaEnabled="True"
  184. CanContentScroll="True"
  185. PreviewMouseWheel="IconListBox_MouseWheel"
  186. >
  187. <Border BorderBrush="{TemplateBinding BorderBrush}"
  188. BorderThickness="{TemplateBinding BorderBrush}"
  189. >
  190. <ItemsPresenter/>
  191. </Border>
  192. </hc:ScrollViewer>
  193. </ControlTemplate>
  194. </ListBox.Template>
  195. <ListBox.Background>
  196. <SolidColorBrush Color="#00FFFFFF" />
  197. </ListBox.Background>
  198. <ListBox.ItemsPanel>
  199. <ItemsPanelTemplate>
  200. <!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
  201. ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  202. ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  203. HorizontalAlignment="Center"
  204. SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>-->
  205. <component:VirtualizingWrapPanel VirtualizationMode="Recycling"
  206. IsVirtualizing="True"
  207. IsContainerVirtualizable="True"
  208. VirtualizingPanel.ScrollUnit="Pixel"
  209. Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
  210. Converter={StaticResource GetWidthByWWConvert},
  211. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_70}}"
  212. />
  213. </ItemsPanelTemplate>
  214. </ListBox.ItemsPanel>
  215. <ListBox.Resources>
  216. <ContextMenu x:Key="IconDialog" Width="200">
  217. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  218. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  219. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  220. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  221. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  222. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  223. <MenuItem Header="从列表移除"
  224. Click="RemoveIcon"
  225. Tag="{Binding}"/>
  226. <!--MenuItem Header="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource ValueConvert}, ConverterParameter={x:Static cst:DictConst.batchMenuHeaderDict}}"
  227. Click="BatchHandle"
  228. Tag="{Binding}"/>-->
  229. </ContextMenu>
  230. </ListBox.Resources>
  231. <ListBox.ItemContainerStyle>
  232. <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
  233. <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
  234. </Style>
  235. </ListBox.ItemContainerStyle>
  236. <ListBox.ItemTemplate>
  237. <DataTemplate>
  238. <hc:SimpleStackPanel Tag="{Binding}"
  239. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  240. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  241. HorizontalAlignment="Center"
  242. Background="#00FFFFFF"
  243. MouseEnter="MenuIcon_MouseEnter"
  244. MouseLeave="MenuIcon_MouseLeave"
  245. MouseMove="MenuIcon_MouseMove"
  246. MouseLeftButtonDown="Icon_MouseLeftButtonDown"
  247. MouseLeftButtonUp="Icon_MouseLeftButtonUp"
  248. >
  249. <!--<CheckBox IsChecked="{Binding IsChecked_NoWrite}" Visibility="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,0,-20" HorizontalAlignment="Right"/>-->
  250. <!--<StackPanel Background="#00FFFFFF"
  251. MouseEnter="CursorPanel_MouseEnter"
  252. MouseLeave="CursorPanel_MouseLeave"
  253. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
  254. <Image Style="{StaticResource ImageStyle}"
  255. RenderOptions.BitmapScalingMode="HighQuality"/>
  256. <!--Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
  257. Converter={StaticResource GetWidthByWWConvert},
  258. ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_70}}"-->
  259. <TextBlock MaxWidth="80"
  260. Margin="0,5,0,0"
  261. MaxHeight="40"
  262. FontSize="13"
  263. TextWrapping="Wrap"
  264. TextTrimming="WordEllipsis"
  265. TextAlignment="Center"
  266. VerticalAlignment="Center"
  267. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  268. Visibility="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ShowIconTitle, Converter={StaticResource MyBoolean2VisibilityConverter}, ConverterParameter={x:Static Visibility.Collapsed}, Mode=TwoWay}"
  269. Text="{Binding Name}"/>
  270. <!--</StackPanel>-->
  271. </hc:SimpleStackPanel>
  272. </DataTemplate>
  273. </ListBox.ItemTemplate>
  274. </ListBox>
  275. <!--</hc:TransitioningContentControl>-->
  276. </UniformGrid>
  277. </WrapPanel>
  278. </Grid>
  279. </hc:DialogContainer>
  280. </hc:Card>
  281. <hc:Card x:Name="VerticalCard"
  282. Visibility="Collapsed"
  283. BorderThickness="1"
  284. Effect="{DynamicResource EffectShadow2}"
  285. Margin="5,0,5,5" Grid.ColumnSpan="2"
  286. MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown"
  287. >
  288. <hc:Card.Background>
  289. <SolidColorBrush Color="AliceBlue"
  290. hc:GeometryEffect.GeometryEffect="20"
  291. Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  292. </hc:Card.Background>
  293. <hc:Card.BorderBrush>
  294. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  295. </hc:Card.BorderBrush>
  296. </hc:Card>
  297. <hc:LoadingCircle x:Name="Loading_RightCard"
  298. Width="45" Height="45"
  299. DotBorderBrush="White"
  300. DotBorderThickness="2"
  301. Foreground="DarkGray"
  302. Opacity="0.8"
  303. DotDiameter="10"
  304. Margin="-50,-150,0,0"
  305. Visibility="Collapsed"
  306. />
  307. </Grid>
  308. </UserControl>