RightCardControl.xaml 8.2 KB

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