| 1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | xmlns:w="clr-namespace:UI.Controls.Window" xmlns:button="clr-namespace:UI.Controls.Button" |
| 4 | xmlns:base="clr-namespace:UI.Controls.Base" |
| 5 | xmlns:input="clr-namespace:UI.Controls.Input"> |
| 6 | <Style x:Key="WindowSystemButton" TargetType="{x:Type Button}"> |
| 7 | <Setter Property="Background" Value="Transparent"/> |
| 8 | <Setter Property="OverridesDefaultStyle" Value="True"/> |
| 9 | <Setter Property="VerticalContentAlignment" Value="Center"/> |
| 10 | <Setter Property="HorizontalContentAlignment" Value="Center"/> |
| 11 | <Setter Property="FontFamily" Value="/Tai;component/Resources/Fonts/#Segoe MDL2 Assets"/> |
| 12 | <Setter Property="Foreground" Value="{DynamicResource TitleBarBtnBrush}"/> |
| 13 | |
| 14 | <Setter Property="FontSize" Value="10"/> |
| 15 | |
| 16 | <Setter Property="Template"> |
| 17 | <Setter.Value> |
| 18 | <ControlTemplate TargetType="{x:Type Button}"> |
| 19 | <Border |
| 20 | Background="{TemplateBinding Background}" |
| 21 | SnapsToDevicePixels="true"> |
| 22 | <ContentPresenter Name="Presenter" Margin="{TemplateBinding Padding}" |
| 23 | VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
| 24 | HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 25 | RecognizesAccessKey="True" |
| 26 | SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> |
| 27 | </Border> |
| 28 | <ControlTemplate.Triggers> |
| 29 | <Trigger Property="IsEnabled" Value="false"> |
| 30 | |
| 31 | </Trigger> |
| 32 | <Trigger Property="IsMouseOver" Value="True"> |
| 33 | <Setter Property="Background" Value="{DynamicResource HoverBackgroundBrush}" /> |
| 34 | <Setter Property="Foreground" Value="{DynamicResource PrimaryColorBrush}"/> |
| 35 | </Trigger> |
| 36 | <Trigger Property="IsPressed" Value="True"> |
| 37 | <Setter Property="Background" Value="{DynamicResource ThemeBrush}" /> |
| 38 | |
| 39 | |
| 40 | <Setter Property="Foreground" Value="White"/> |
| 41 | </Trigger> |
| 42 | <Trigger Property="IsFocused" Value="true"> |
| 43 | |
| 44 | </Trigger> |
| 45 | </ControlTemplate.Triggers> |
| 46 | </ControlTemplate> |
| 47 | </Setter.Value> |
| 48 | </Setter> |
| 49 | </Style> |
| 50 | <Style TargetType="{x:Type w:DefaultWindow}"> |
| 51 | |
| 52 | |
| 53 | <Setter Property="Background" Value="Transparent" /> |
| 54 | |
| 55 | <Setter Property="Foreground" Value="{DynamicResource StandardTextBrush}" /> |
| 56 | |
| 57 | <Setter Property="ResizeMode" Value="CanResizeWithGrip" /> |
| 58 | <Setter Property="UseLayoutRounding" Value="True" /> |
| 59 | <Setter Property="TextOptions.TextFormattingMode" Value="Display"/> |
| 60 | <Setter Property="WindowChrome.WindowChrome"> |
| 61 | <Setter.Value> |
| 62 | <WindowChrome |
| 63 | CaptionHeight="32" |
| 64 | CornerRadius="0" GlassFrameThickness="1" UseAeroCaptionButtons="False" NonClientFrameEdges="None" /> |
| 65 | </Setter.Value> |
| 66 | </Setter> |
| 67 | <Setter Property="Template"> |
| 68 | <Setter.Value> |
| 69 | <ControlTemplate TargetType="{x:Type w:DefaultWindow}"> |
| 70 | <ControlTemplate.Resources> |
| 71 | |
| 72 | <Storyboard x:Key="Storyboardload"> |
| 73 | <DoubleAnimation Storyboard.TargetName="WindowBorder" Storyboard.TargetProperty="Opacity" Duration="00:00:0.1" From="0" To="1" > |
| 74 | </DoubleAnimation> |
| 75 | </Storyboard> |
| 76 | |
| 77 | </ControlTemplate.Resources> |
| 78 | <Border x:Name="WindowBorder" |
| 79 | Margin="{Binding Source={x:Static SystemParameters.WindowNonClientFrameThickness}}"> |
| 80 | <Border |
| 81 | BorderThickness="1" |
| 82 | BorderBrush="{DynamicResource WindowBorderBrush}" |
| 83 | Background="{DynamicResource WindowBackground}" |
| 84 | > |
| 85 | <AdornerDecorator> |
| 86 | <Grid x:Name="WindowContent"> |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | <Grid |
| 96 | x:Name="TitleBar" |
| 97 | Panel.ZIndex="999" |
| 98 | Height="{DynamicResource WindowTitleBarHeight}" |
| 99 | VerticalAlignment="Top"> |
| 100 | <Grid.ColumnDefinitions> |
| 101 | <ColumnDefinition Width="Auto"></ColumnDefinition> |
| 102 | <ColumnDefinition Width="*"></ColumnDefinition> |
| 103 | |
| 104 | </Grid.ColumnDefinitions> |
| 105 | |
| 106 | <Grid Grid.Column="0" |
| 107 | Panel.ZIndex="3"> |
| 108 | |
| 109 | <StackPanel Orientation="Horizontal" Margin="15,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"> |
| 110 | |
| 111 | <button:IconButton Width="0" VerticalAlignment="Center" ToolTip="返回" FontSize="10" x:Name="BackBtn" Icon="Back" WindowChrome.IsHitTestVisibleInChrome="True" Command="{x:Static w:DefaultWindowCommands.BackCommand}"/> |
| 112 | |
| 113 | <Image Source="{TemplateBinding Icon}" VerticalAlignment="Center" Stretch="Uniform" Width="18"/> |
| 114 | <TextBlock VerticalAlignment="Center" Text="{TemplateBinding Title}" IsEnabled="{TemplateBinding IsActive}" Foreground="{DynamicResource DefaultTextBrush}" Margin="15,0,0,0"/> |
| 115 | </StackPanel> |
| 116 | |
| 117 | |
| 118 | </Grid> |
| 119 | <Grid Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top" |
| 120 | WindowChrome.IsHitTestVisibleInChrome="True" |
| 121 | Panel.ZIndex="3"> |
| 122 | |
| 123 | |
| 124 | <StackPanel Orientation="Horizontal"> |
| 125 | |
| 126 | <button:IconButton |
| 127 | ToolTip="最小化" |
| 128 | Width="46" |
| 129 | Height="32" |
| 130 | FontSize="10" |
| 131 | Icon="ChromeMinimize" |
| 132 | Command="{x:Static w:DefaultWindowCommands.MinimizeWindowCommand}" |
| 133 | Visibility="{TemplateBinding MinimizeVisibility}"/> |
| 134 | |
| 135 | |
| 136 | <button:IconButton |
| 137 | x:Name="MaximizeButton" |
| 138 | ToolTip="最大化" |
| 139 | Width="46" |
| 140 | Height="32" |
| 141 | FontSize="10" |
| 142 | Icon="ChromeMaximize" |
| 143 | Command="{x:Static w:DefaultWindowCommands.MaximizeWindowCommand}" |
| 144 | Visibility="{TemplateBinding MaximizeVisibility}"/> |
| 145 | |
| 146 | <button:IconButton |
| 147 | x:Name="RestoreButton" |
| 148 | ToolTip="向下还原" |
| 149 | Width="46" |
| 150 | Height="32" |
| 151 | FontSize="10" |
| 152 | Icon="ChromeRestore" |
| 153 | Command="{x:Static w:DefaultWindowCommands.RestoreWindowCommand}" |
| 154 | Visibility="Collapsed"/> |
| 155 | |
| 156 | <button:IconButton |
| 157 | ToolTip="关闭" |
| 158 | Width="46" |
| 159 | Height="32" |
| 160 | FontSize="10" |
| 161 | Icon="ChromeClose" |
| 162 | Command="{x:Static w:DefaultWindowCommands.CloseWindowCommand}" |
| 163 | Visibility="{TemplateBinding CloseVisibility}"/> |
| 164 | |
| 165 | </StackPanel> |
| 166 | |
| 167 | |
| 168 | </Grid> |
| 169 | </Grid> |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | <ContentPresenter Grid.Row="1"/> |
| 175 | |
| 176 | <Grid Panel.ZIndex="999" x:Name="ToastGrid" Visibility="Collapsed"> |
| 177 | |
| 178 | <Border |
| 179 | Padding="15,15" |
| 180 | CornerRadius="12" |
| 181 | MaxWidth="320" |
| 182 | x:Name="ToastBorder" Background="White" HorizontalAlignment="Center" VerticalAlignment="Top" Panel.ZIndex="99999"> |
| 183 | <Border.RenderTransform> |
| 184 | <TransformGroup> |
| 185 | <TranslateTransform Y="-150"/> |
| 186 | </TransformGroup> |
| 187 | </Border.RenderTransform> |
| 188 | <Border.Effect> |
| 189 | <DropShadowEffect BlurRadius="10" Color="Black" Opacity=".1"/> |
| 190 | </Border.Effect> |
| 191 | <Grid > |
| 192 | <Grid.ColumnDefinitions> |
| 193 | <ColumnDefinition Width="30"/> |
| 194 | <ColumnDefinition Width="*"/> |
| 195 | |
| 196 | </Grid.ColumnDefinitions> |
| 197 | <base:Icon IconType="{TemplateBinding ToastIcon}" VerticalAlignment="Top" Margin="0,0,10,0" x:Name="ToastIcon"/> |
| 198 | <TextBlock x:Name="ToastText" Grid.Column="1" Text="{TemplateBinding ToastContent}" VerticalAlignment="Top" TextWrapping="WrapWithOverflow"/> |
| 199 | </Grid> |
| 200 | </Border> |
| 201 | |
| 202 | <Border |
| 203 | Padding="15,15" |
| 204 | CornerRadius="10" |
| 205 | Width="300" |
| 206 | x:Name="DialogBorder" Background="White" HorizontalAlignment="Center" VerticalAlignment="Top" Panel.ZIndex="1000"> |
| 207 | <Border.RenderTransform> |
| 208 | <TransformGroup> |
| 209 | <TranslateTransform Y="-150"/> |
| 210 | </TransformGroup> |
| 211 | </Border.RenderTransform> |
| 212 | <Border.Effect> |
| 213 | <DropShadowEffect BlurRadius="10" Color="Black" Opacity=".1"/> |
| 214 | </Border.Effect> |
| 215 | <Grid > |
| 216 | <Grid.RowDefinitions> |
| 217 | <RowDefinition Height="40"/> |
| 218 | <RowDefinition Height="auto"/> |
| 219 | <RowDefinition Height="auto"/> |
| 220 | </Grid.RowDefinitions> |
| 221 | <TextBlock Text="{TemplateBinding DialogTitle}" FontSize="16" FontWeight="Bold"/> |
| 222 | <TextBlock Grid.Row="1" Text="{TemplateBinding DialogMessage}" VerticalAlignment="Top" TextWrapping="WrapWithOverflow"/> |
| 223 | <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,20,0,0"> |
| 224 | <button:Button x:Name="CancelBtn" Width="100">取消</button:Button> |
| 225 | <button:Button x:Name="ConfirmBtn" Background="{DynamicResource ThemeBrush}" Foreground="White" Width="100" Margin="10,0,0,0">确定</button:Button> |
| 226 | </StackPanel> |
| 227 | </Grid> |
| 228 | </Border> |
| 229 | |
| 230 | <Border |
| 231 | Padding="15,15" |
| 232 | CornerRadius="10" |
| 233 | Width="350" |
| 234 | x:Name="InputModalBorder" Background="White" HorizontalAlignment="Center" VerticalAlignment="Top" Panel.ZIndex="1000"> |
| 235 | <Border.RenderTransform> |
| 236 | <TransformGroup> |
| 237 | <TranslateTransform Y="-150"/> |
| 238 | </TransformGroup> |
| 239 | </Border.RenderTransform> |
| 240 | <Border.Effect> |
| 241 | <DropShadowEffect BlurRadius="10" Color="Black" Opacity=".1"/> |
| 242 | </Border.Effect> |
| 243 | <Grid > |
| 244 | <Grid.RowDefinitions> |
| 245 | <RowDefinition Height="40"/> |
| 246 | <RowDefinition Height="auto"/> |
| 247 | <RowDefinition Height="auto"/> |
| 248 | </Grid.RowDefinitions> |
| 249 | <TextBlock Text="{TemplateBinding DialogTitle}" FontSize="16" FontWeight="Bold"/> |
| 250 | <Border Grid.Row="1"> |
| 251 | <input:InputBox x:Name="InputModalInputBox" Placeholder="{TemplateBinding DialogMessage}"></input:InputBox> |
| 252 | </Border> |
| 253 | <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0"> |
| 254 | <button:Button x:Name="InputModalCancelBtn" Width="100">取消</button:Button> |
| 255 | <button:Button x:Name="InputModalConfirmBtn" Background="{DynamicResource ThemeBrush}" Foreground="White" Width="100" Margin="10,0,0,0">确定</button:Button> |
| 256 | </StackPanel> |
| 257 | </Grid> |
| 258 | </Border> |
| 259 | |
| 260 | <Border x:Name="Masklayer" Background="Black" Opacity="0"></Border> |
| 261 | </Grid> |
| 262 | </Grid> |
| 263 | </AdornerDecorator> |
| 264 | </Border> |
| 265 | <VisualStateManager.VisualStateGroups> |
| 266 | <VisualStateGroup x:Name="CommonStates"> |
| 267 | <VisualStateGroup.Transitions> |
| 268 | <VisualTransition GeneratedDuration="0:0:.15" /> |
| 269 | <VisualTransition GeneratedDuration="0" |
| 270 | To="Pressed" /> |
| 271 | </VisualStateGroup.Transitions> |
| 272 | <VisualState x:Name="Normal" /> |
| 273 | <VisualState x:Name="CanBackState"> |
| 274 | <Storyboard > |
| 275 | <DoubleAnimation Storyboard.TargetProperty="(Button.Width)" |
| 276 | Storyboard.TargetName="BackBtn" To="35" Duration="0:0:.1"> |
| 277 | </DoubleAnimation> |
| 278 | </Storyboard> |
| 279 | </VisualState> |
| 280 | |
| 281 | </VisualStateGroup> |
| 282 | </VisualStateManager.VisualStateGroups> |
| 283 | </Border> |
| 284 | <ControlTemplate.Triggers> |
| 285 | <Trigger Property="ToastType" Value="Success"> |
| 286 | <Setter TargetName="ToastBorder" Property="Background" Value="#24bf5f" /> |
| 287 | <Setter TargetName="ToastIcon" Property="Foreground" Value="#fff" /> |
| 288 | <Setter TargetName="ToastText" Property="Foreground" Value="#fff" /> |
| 289 | </Trigger> |
| 290 | <Trigger Property="ToastType" Value="Error"> |
| 291 | <Setter TargetName="ToastBorder" Property="Background" Value="#f54f4e" /> |
| 292 | <Setter TargetName="ToastIcon" Property="Foreground" Value="#fff" /> |
| 293 | <Setter TargetName="ToastText" Property="Foreground" Value="#fff" /> |
| 294 | </Trigger> |
| 295 | <MultiTrigger> |
| 296 | <MultiTrigger.Conditions> |
| 297 | <Condition Property="WindowState" Value="Normal" /> |
| 298 | <Condition Property="MaximizeVisibility" Value="Visible" /> |
| 299 | </MultiTrigger.Conditions> |
| 300 | <Setter TargetName="MaximizeButton" Property="Visibility" Value="Visible" /> |
| 301 | <Setter TargetName="RestoreButton" Property="Visibility" Value="Collapsed" /> |
| 302 | </MultiTrigger> |
| 303 | <Trigger Property="WindowState" Value="Maximized"> |
| 304 | |
| 305 | <Setter TargetName="WindowContent" Property="Margin" Value="7"/> |
| 306 | <Setter TargetName="MaximizeButton" Property="Visibility" Value="Collapsed" /> |
| 307 | <Setter TargetName="RestoreButton" Property="Visibility" Value="Visible" /> |
| 308 | </Trigger> |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | <Trigger Property="WindowStyle" Value="None"> |
| 325 | <Setter TargetName="WindowBorder" Property="Margin" Value="0"/> |
| 326 | <Setter Property="BorderThickness" Value="0"/> |
| 327 | <Setter TargetName="TitleBar" Property="Visibility" Value="Collapsed" /> |
| 328 | <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" /> |
| 329 | |
| 330 | </Trigger> |
| 331 | </ControlTemplate.Triggers> |
| 332 | </ControlTemplate> |
| 333 | </Setter.Value> |
| 334 | </Setter> |
| 335 | |
| 336 | </Style> |
| 337 | |
| 338 | |
| 339 | </ResourceDictionary> |