You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.7 KiB

  1. <prism:PrismApplication x:Class="ModbusDemo.App"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:local="clr-namespace:ModbusDemo"
  5. xmlns:prism="http://prismlibrary.com/"
  6. xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
  7. >
  8. <Application.Resources>
  9. <ResourceDictionary>
  10. <ResourceDictionary.MergedDictionaries>
  11. <!-- 使用捆绑的主题,设置基础主题为浅色,主色为深紫色,次色为酸橙色 -->
  12. <materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="LightBlue" SecondaryColor="Lime" />
  13. <!-- 引用 Material Design 2 的默认样式 -->
  14. <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign2.Defaults.xaml" />
  15. </ResourceDictionary.MergedDictionaries>
  16. <Style x:Key="LeftMenuStyle" TargetType="ListBoxItem">
  17. <Setter Property="MinHeight" Value="40"></Setter>
  18. <Setter Property="Template">
  19. <Setter.Value>
  20. <ControlTemplate TargetType="ListBoxItem">
  21. <Grid>
  22. <Border x:Name="border"></Border>
  23. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"></ContentPresenter>
  24. </Grid>
  25. <!--触发器-->
  26. <ControlTemplate.Triggers>
  27. <Trigger Property="IsSelected" Value="True">
  28. <Setter TargetName="border" Property="Background" Value="{DynamicResource PrimaryHueLightBrush}"></Setter>
  29. <Setter TargetName="border" Property="Opacity" Value="0.2"></Setter>
  30. </Trigger>
  31. <Trigger Property="IsMouseOver" Value="True">
  32. <Setter TargetName="border" Property="Background" Value="{DynamicResource PrimaryHueLightBrush}"></Setter>
  33. <Setter TargetName="border" Property="Opacity" Value="0.2"></Setter>
  34. </Trigger>
  35. </ControlTemplate.Triggers>
  36. </ControlTemplate>
  37. </Setter.Value>
  38. </Setter>
  39. </Style>
  40. </ResourceDictionary>
  41. </Application.Resources>
  42. </prism:PrismApplication>