TitleBar.xaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <UserControl x:Class="NEIntelligentControl2.Views.MainWindow.TitleBar"
  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:NEIntelligentControl2.Views.MainWindow"
  7. mc:Ignorable="d"
  8. d:DesignHeight="68" d:DesignWidth="1920">
  9. <UserControl.Resources>
  10. <SolidColorBrush x:Key="TitleBackground" Color="#FF253887"/>
  11. <SolidColorBrush x:Key="TitleMouseOver" Color="#FF4D62BD"/>
  12. <SolidColorBrush x:Key="ListBox.Foreground" Color="WhiteSmoke"/>
  13. <Style x:Key="TitleGridStyle" TargetType="Grid">
  14. <Setter Property="Background" Value="{StaticResource TitleBackground}"/>
  15. <Style.Triggers>
  16. <Trigger Property="IsMouseOver" Value="True">
  17. <Setter Property="Background" Value="{StaticResource TitleMouseOver}"/>
  18. </Trigger>
  19. </Style.Triggers>
  20. </Style>
  21. <Style x:Key="ListBoxStyleMain" TargetType="{x:Type ListBox}">
  22. <Setter Property="Foreground" Value="{StaticResource ListBox.Foreground}"/>
  23. <Setter Property="VerticalContentAlignment" Value="Stretch"/>
  24. <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
  25. <Setter Property="BorderThickness" Value="0"/>
  26. <Setter Property="Template">
  27. <Setter.Value>
  28. <ControlTemplate TargetType="{x:Type ListBox}">
  29. <Border x:Name="Bd" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
  30. <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
  31. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  32. </ScrollViewer>
  33. </Border>
  34. <ControlTemplate.Triggers>
  35. <Trigger Property="IsEnabled" Value="false">
  36. </Trigger>
  37. <MultiTrigger>
  38. <MultiTrigger.Conditions>
  39. <Condition Property="IsGrouping" Value="true"/>
  40. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
  41. </MultiTrigger.Conditions>
  42. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  43. </MultiTrigger>
  44. </ControlTemplate.Triggers>
  45. </ControlTemplate>
  46. </Setter.Value>
  47. </Setter>
  48. </Style>
  49. <ItemsPanelTemplate x:Key="ItemsPanelTemplateMian">
  50. <VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/>
  51. </ItemsPanelTemplate>
  52. <Style x:Key="ListBoxItemStyleMain" TargetType="{x:Type ListBoxItem}">
  53. <Setter Property="SnapsToDevicePixels" Value="True"/>
  54. <Setter Property="Padding" Value="4,0"/>
  55. <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
  56. <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
  57. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  58. <Setter Property="Template">
  59. <Setter.Value>
  60. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  61. <Border x:Name="Bd" SnapsToDevicePixels="true" MinWidth="92" MaxWidth="94" VerticalAlignment="Stretch">
  62. <Border.Background>
  63. <ImageBrush ImageSource="pack://application:,,,/智动启停;component/Images/TitleBar/item_background.png"/>
  64. </Border.Background>
  65. <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,5"/>
  66. </Border>
  67. <ControlTemplate.Triggers>
  68. <Trigger Property="IsSelected" Value="True">
  69. <Setter Property="Background" TargetName="Bd">
  70. <Setter.Value>
  71. <ImageBrush ImageSource="pack://application:,,,/智动启停;component/Images/TitleBar/item_background_selected.png"/>
  72. </Setter.Value>
  73. </Setter>
  74. <Setter Property="Foreground" Value="#FF2F31B0"/>
  75. </Trigger>
  76. </ControlTemplate.Triggers>
  77. </ControlTemplate>
  78. </Setter.Value>
  79. </Setter>
  80. </Style>
  81. <Style x:Key="PopupItemGrid" TargetType="Grid">
  82. <Setter Property="Height" Value="44"/>
  83. <Style.Triggers>
  84. <Trigger Property="IsMouseOver" Value="True">
  85. <Setter Property="Background" Value="#FF646464"/>
  86. </Trigger>
  87. </Style.Triggers>
  88. </Style>
  89. </UserControl.Resources>
  90. <Grid SnapsToDevicePixels="True" Background="{StaticResource TitleBackground}">
  91. <Grid.ColumnDefinitions>
  92. <ColumnDefinition/>
  93. <ColumnDefinition Width="2.3*"/>
  94. <ColumnDefinition Width="Auto"/>
  95. </Grid.ColumnDefinitions>
  96. <Image Source="pack://application:,,,/智动启停;component/Images/TitleBar/background.png" HorizontalAlignment="Left" Margin="20,0,0,0"/>
  97. <ListBox Visibility="Collapsed" x:Name="_LBMain" Grid.Column="1" DisplayMemberPath="Name" Style="{StaticResource ListBoxStyleMain}" ItemsPanel="{StaticResource ItemsPanelTemplateMian}" ItemContainerStyle="{StaticResource ListBoxItemStyleMain}" Height="33" VerticalAlignment="Bottom" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" SelectionChanged="_LBMain_SelectionChanged"/>
  98. <Grid Grid.Column="2">
  99. <Grid.ColumnDefinitions>
  100. <ColumnDefinition/>
  101. <ColumnDefinition Width="Auto"/>
  102. <ColumnDefinition Width="Auto"/>
  103. </Grid.ColumnDefinitions>
  104. <Grid Width="117" Style="{StaticResource TitleGridStyle}" MouseLeftButtonUp="Grid_MouseLeftButtonUp" Tag="user" Visibility="Hidden">
  105. <Grid.ColumnDefinitions>
  106. <ColumnDefinition Width="2*"/>
  107. <ColumnDefinition/>
  108. </Grid.ColumnDefinitions>
  109. <TextBlock x:Name="_TBUser" Text="未登录" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="WhiteSmoke" FontSize="18"/>
  110. <Viewbox Width="27" Height="27" Grid.Column="1">
  111. <Canvas Width="1024" Height="1024">
  112. <Path Fill="WhiteSmoke" Data="M501.937582 545.097053c147.891962 0 268.231366-118.534055 268.223274-264.288929 0-145.746783-120.330301-264.28994-268.222263-264.28994-147.890951 0-268.221252 118.584625-268.221252 264.28994C233.71633 426.520519 354.046631 545.097053 501.937582 545.097053zM612.471463 570.546911 411.497184 570.546911c-186.760063 0-338.664249 149.569875-338.664249 333.472733l0 19.794109c0 96.139636 149.47278 96.139636 338.664249 96.139636l200.974278 0c181.747565 0 338.694591 0 338.694591-96.139636l0-19.794109C951.164031 720.158252 799.235571 570.546911 612.471463 570.546911z"/>
  113. </Canvas>
  114. </Viewbox>
  115. </Grid>
  116. <Rectangle Grid.Column="1" Fill="WhiteSmoke" Width="2"/>
  117. <Grid Grid.Column="2" Width="68" Style="{StaticResource TitleGridStyle}" MouseLeftButtonUp="Grid_MouseLeftButtonUp" Tag="close">
  118. <Viewbox Width="27" Height="27">
  119. <Canvas Width="1024" Height="1024">
  120. <Path Fill="WhiteSmoke" Data="M464.621946 124.483152c0-26.264177 21.324678-47.589878 47.582715-47.589878 26.258037 0 47.662533 21.324678 47.662533 47.589878v299.552424c0 26.264177-21.404496 47.589878-47.662533 47.589878-26.258037 0-47.582715-21.324678-47.582715-47.589878v-299.552424z"/>
  121. <Path Fill="WhiteSmoke" Data="M813.450656 822.458821c-166.205393 166.205393-436.678524 166.205393-602.936105-0.053212-166.205393-166.205393-166.205393-436.678524 0-602.883917 18.191314-18.191314 47.709605-18.191314 65.900919 0s18.191314 47.709605 0 65.900919c-129.868813 129.875976-129.868813 341.207126 0 471.082079 129.868813 129.868813 341.260337 129.922025 471.129151 0.053212 129.875976-129.875976 129.875976-341.319689 0-471.188502-18.191314-18.191314-18.191314-47.708582 0-65.90092 18.198477-18.191314 47.708582-18.191314 65.907059 0 166.250418 166.259628 166.250418 436.732759-0.001024 602.990341z"/>
  122. </Canvas>
  123. </Viewbox>
  124. </Grid>
  125. <Popup x:Name="_PUser" Width="205">
  126. <Grid Background="#FF454545" MouseLeave="Grid_MouseLeave">
  127. <Grid.RowDefinitions>
  128. <RowDefinition/>
  129. <RowDefinition/>
  130. <RowDefinition/>
  131. </Grid.RowDefinitions>
  132. <Grid Style="{StaticResource PopupItemGrid}" MouseLeftButtonUp="Grid_MouseLeftButtonUp" Tag="useradd">
  133. <Grid.ColumnDefinitions>
  134. <ColumnDefinition/>
  135. <ColumnDefinition Width="2*"/>
  136. </Grid.ColumnDefinitions>
  137. <Image Width="32" Height="32" Source="pack://application:,,,/智动启停;component/Images/TitleBar/user_add.png"/>
  138. <TextBlock Grid.Column="1" Text="用户添加" VerticalAlignment="Center" Foreground="WhiteSmoke" FontSize="15"/>
  139. </Grid>
  140. <Grid Grid.Row="1" Style="{StaticResource PopupItemGrid}" MouseLeftButtonUp="Grid_MouseLeftButtonUp" Tag="useredit">
  141. <Grid.ColumnDefinitions>
  142. <ColumnDefinition/>
  143. <ColumnDefinition Width="2*"/>
  144. </Grid.ColumnDefinitions>
  145. <Image Width="32" Height="32" Source="pack://application:,,,/智动启停;component/Images/TitleBar/user_edit.png"/>
  146. <TextBlock Grid.Column="1" Text="用户编辑" VerticalAlignment="Center" Foreground="WhiteSmoke" FontSize="15"/>
  147. </Grid>
  148. <Grid Grid.Row="2" Style="{StaticResource PopupItemGrid}" MouseLeftButtonUp="Grid_MouseLeftButtonUp" Tag="logout">
  149. <Grid.ColumnDefinitions>
  150. <ColumnDefinition/>
  151. <ColumnDefinition Width="2*"/>
  152. </Grid.ColumnDefinitions>
  153. <Image Width="32" Height="32" Source="pack://application:,,,/智动启停;component/Images/TitleBar/user_logout.png"/>
  154. <TextBlock Grid.Column="1" Text="注 销" VerticalAlignment="Center" Foreground="WhiteSmoke" FontSize="15"/>
  155. </Grid>
  156. </Grid>
  157. </Popup>
  158. </Grid>
  159. </Grid>
  160. </UserControl>