RightCardControl.xaml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
  7. xmlns:hc="https://handyorg.github.io/handycontrol"
  8. xmlns:cvt="clr-namespace:GeekDesk.Converts"
  9. xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
  10. mc:Ignorable="d"
  11. d:DesignHeight="450" d:DesignWidth="800"
  12. >
  13. <UserControl.Resources>
  14. <!--右侧栏样式动画-->
  15. <Style x:Key="ImageStyle" TargetType="Image">
  16. <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
  17. <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
  18. <Setter Property="Source" Value="{Binding BitmapImage}"/>
  19. </Style>
  20. <Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
  21. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  22. <Setter Property="Template">
  23. <Setter.Value>
  24. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  25. <Border>
  26. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  27. </Border>
  28. </ControlTemplate>
  29. </Setter.Value>
  30. </Setter>
  31. </Style>
  32. <cvt:OpcityConvert x:Key="OpcityConvert"/>
  33. </UserControl.Resources>
  34. <!--右侧栏-->
  35. <hc:Card AllowDrop="True"
  36. Drop="Wrap_Drop"
  37. BorderThickness="1"
  38. Effect="{DynamicResource EffectShadow2}"
  39. Margin="5,0,5,5" Grid.ColumnSpan="2">
  40. <hc:Card.Background>
  41. <SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
  42. </hc:Card.Background>
  43. <hc:Card.BorderBrush>
  44. <SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
  45. </hc:Card.BorderBrush>
  46. <hc:Card.ContextMenu>
  47. <ContextMenu Width="200">
  48. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  49. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  50. </ContextMenu>
  51. </hc:Card.ContextMenu>
  52. <WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
  53. VirtualizingPanel.IsVirtualizing="True"
  54. VirtualizingPanel.IsContainerVirtualizable="True"
  55. >
  56. <ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
  57. BorderThickness="0"
  58. Padding="0,10,0,0"
  59. >
  60. <ListBox.Background>
  61. <SolidColorBrush Opacity="0"/>
  62. </ListBox.Background>
  63. <ListBox.ItemsPanel>
  64. <ItemsPanelTemplate>
  65. <DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
  66. ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  67. ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  68. HorizontalAlignment="Center"
  69. SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
  70. </ItemsPanelTemplate>
  71. </ListBox.ItemsPanel>
  72. <ListBox.Resources>
  73. <ContextMenu x:Key="IconDialog" Width="200">
  74. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  75. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  76. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  77. <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
  78. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  79. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  80. <MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
  81. </ContextMenu>
  82. </ListBox.Resources>
  83. <ListBox.ItemContainerStyle>
  84. <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
  85. <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
  86. <!--<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"/>
  87. <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"/>-->
  88. </Style>
  89. </ListBox.ItemContainerStyle>
  90. <!--Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  91. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"-->
  92. <ListBox.ItemTemplate>
  93. <DataTemplate>
  94. <hc:SimpleStackPanel Tag="{Binding}"
  95. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
  96. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
  97. HorizontalAlignment="Center"
  98. hc:Poptip.HitMode="None"
  99. hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
  100. hc:Poptip.Content="{Binding Content}"
  101. hc:Poptip.Placement="BottomLeft"
  102. Background="#00FFFFFF"
  103. MouseLeftButtonDown="IconClick"
  104. MouseEnter="StackPanel_MouseEnter"
  105. MouseLeave="StackPanel_MouseLeave"
  106. >
  107. <Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
  108. <TextBlock MaxWidth="80"
  109. Margin="0,5,0,0"
  110. MaxHeight="40"
  111. FontSize="13"
  112. TextWrapping="Wrap"
  113. TextTrimming="WordEllipsis"
  114. TextAlignment="Center"
  115. VerticalAlignment="Center"
  116. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  117. Text="{Binding Name}"/>
  118. </hc:SimpleStackPanel>
  119. </DataTemplate>
  120. </ListBox.ItemTemplate>
  121. </ListBox>
  122. </WrapPanel>
  123. </hc:Card>
  124. </UserControl>