選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

54 行
2.8 KiB

  1. <prism:PrismApplication
  2. x:Class="ModbusDemo.App"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:local="clr-namespace:ModbusDemo"
  6. xmlns:prism="http://prismlibrary.com/"
  7. xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
  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">
  18. </Setter>
  19. <Setter Property="Template">
  20. <Setter.Value>
  21. <ControlTemplate TargetType="ListBoxItem">
  22. <Grid>
  23. <Border x:Name="border">
  24. </Border>
  25. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
  26. </ContentPresenter>
  27. </Grid>
  28. <!-- 触发器 -->
  29. <ControlTemplate.Triggers>
  30. <Trigger Property="IsSelected" Value="True">
  31. <Setter TargetName="border" Property="Background" Value="{DynamicResource PrimaryHueLightBrush}">
  32. </Setter>
  33. <Setter TargetName="border" Property="Opacity" Value="0.2">
  34. </Setter>
  35. </Trigger>
  36. <Trigger Property="IsMouseOver" Value="True">
  37. <Setter TargetName="border" Property="Background" Value="{DynamicResource PrimaryHueLightBrush}">
  38. </Setter>
  39. <Setter TargetName="border" Property="Opacity" Value="0.2">
  40. </Setter>
  41. </Trigger>
  42. </ControlTemplate.Triggers>
  43. </ControlTemplate>
  44. </Setter.Value>
  45. </Setter>
  46. </Style>
  47. </ResourceDictionary>
  48. </Application.Resources>
  49. </prism:PrismApplication>