RightCardControl.xaml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. <UserControl.Resources>
  13. <!--右侧栏样式动画-->
  14. <Style x:Key="ImageStyle" TargetType="Image">
  15. <Setter Property="Width" Value="{Binding ImageWidth}"/>
  16. <Setter Property="Height" Value="{Binding ImageHeight}"/>
  17. <Setter Property="Source" Value="{Binding BitmapImage}"/>
  18. <Setter Property="RenderOptions.BitmapScalingMode" Value="LowQuality" />
  19. <Setter Property="RenderOptions.CachingHint" Value="Cache" />
  20. </Style>
  21. <Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
  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. </ContextMenu>
  50. </hc:Card.ContextMenu>
  51. <WrapPanel Orientation="Horizontal">
  52. <ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
  53. BorderThickness="0"
  54. >
  55. <ListBox.Background>
  56. <SolidColorBrush Opacity="0"/>
  57. </ListBox.Background>
  58. <ListBox.ItemsPanel>
  59. <ItemsPanelTemplate>
  60. <DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight}"
  61. ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth}"
  62. Background="#00FFFFFF"
  63. HorizontalAlignment="Center"
  64. SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
  65. </ItemsPanelTemplate>
  66. </ListBox.ItemsPanel>
  67. <ListBox.Resources>
  68. <ContextMenu x:Key="IconDialog" Width="200">
  69. <MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
  70. <MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
  71. <MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
  72. <MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
  73. <MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
  74. <MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
  75. </ContextMenu>
  76. </ListBox.Resources>
  77. <ListBox.ItemContainerStyle>
  78. <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
  79. <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
  80. </Style>
  81. </ListBox.ItemContainerStyle>
  82. <ListBox.ItemTemplate>
  83. <DataTemplate>
  84. <StackPanel Tag="{Binding}"
  85. Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight}"
  86. Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth}"
  87. HorizontalAlignment="Center"
  88. hc:Poptip.HitMode="None"
  89. hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
  90. hc:Poptip.Content="{Binding Content}"
  91. hc:Poptip.Placement="BottomLeft"
  92. Background="#00FFFFFF"
  93. MouseLeftButtonUp="IconClick"
  94. MouseEnter="StackPanel_MouseEnter"
  95. MouseLeave="StackPanel_MouseLeave"
  96. >
  97. <Image Style="{StaticResource ImageStyle}"/>
  98. <TextBlock MaxWidth="80"
  99. Margin="0,5,0,0"
  100. MaxHeight="40"
  101. FontSize="13"
  102. TextWrapping="Wrap"
  103. TextTrimming="WordEllipsis"
  104. TextAlignment="Center"
  105. VerticalAlignment="Center"
  106. Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
  107. Text="{Binding Name}"/>
  108. </StackPanel>
  109. </DataTemplate>
  110. </ListBox.ItemTemplate>
  111. </ListBox>
  112. </WrapPanel>
  113. </hc:Card>
  114. </UserControl>