customise the messagebox
This commit is contained in:
1 parent
8a8241f0e6
commit
43d1e7e4f4
15 files changed
+268
-115
No files matched your search
@@ -1,23 +1,26 @@
|
||||
<controls:BlurWindow x:Class="HandyControlDemo.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
mc:Ignorable="d"
|
||||
BorderThickness="1"
|
||||
BorderBrush="#262e2f"
|
||||
NonClientAreaBackground="#262e2f"
|
||||
OtherButtonHoverBackground="#888580"
|
||||
Style="{StaticResource WindowBlur}"
|
||||
WindowState="Maximized"
|
||||
Title="MainWindow"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
Name="MyWindow"
|
||||
DataContext="{Binding Main,Source={StaticResource Locator}}"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="1400">
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
mc:Ignorable="d"
|
||||
BorderThickness="1"
|
||||
BorderBrush="#262e2f"
|
||||
NonClientAreaBackground="#262e2f"
|
||||
OtherButtonHoverBackground="#888580"
|
||||
CloseButtonForeground="White"
|
||||
OtherButtonHoverForeground="White"
|
||||
OtherButtonForeground="White"
|
||||
Style="{StaticResource WindowBlur}"
|
||||
WindowState="Maximized"
|
||||
Title="MainWindow"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
Name="MyWindow"
|
||||
DataContext="{Binding Main,Source={StaticResource Locator}}"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="1400">
|
||||
<controls:Window.NonClientAreaContent>
|
||||
<userControl:NoUserContent/>
|
||||
</controls:Window.NonClientAreaContent>
|
||||
|
||||
+10
-1
@@ -47,7 +47,7 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性
|
||||
/// 使用此强类型资源类,为所有资源查找
|
||||
/// 重写当前线程的 CurrentUICulture 属性。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
@@ -654,6 +654,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 点击打开自定义消息窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string OpenCustomMessageWindow {
|
||||
get {
|
||||
return ResourceManager.GetString("OpenCustomMessageWindow", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 点击打开自定义非客户端区域窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -480,4 +480,7 @@
|
||||
<data name="UploadStr" xml:space="preserve">
|
||||
<value>Upload;Uploading</value>
|
||||
</data>
|
||||
<data name="OpenCustomMessageWindow" xml:space="preserve">
|
||||
<value>open custom message window</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -480,4 +480,7 @@
|
||||
<data name="UploadStr" xml:space="preserve">
|
||||
<value>上传;上传中</value>
|
||||
</data>
|
||||
<data name="OpenCustomMessageWindow" xml:space="preserve">
|
||||
<value>点击打开自定义消息窗口</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,7 +1,8 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl">
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
|
||||
xmlns:langs="clr-namespace:HandyControl.Properties.Langs;assembly=HandyControl">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Basic/Geometries.xaml"/>
|
||||
@@ -90,4 +91,37 @@
|
||||
</WrapPanel>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="MessageBoxCustom" TargetType="controls:MessageBox" BasedOn="{StaticResource {x:Type controls:MessageBox}}">
|
||||
<Setter Property="NonClientAreaBackground" Value="#262e2f"/>
|
||||
<Setter Property="OtherButtonHoverBackground" Value="#888580"/>
|
||||
<Setter Property="OtherButtonForeground" Value="White"/>
|
||||
<Setter Property="OtherButtonHoverForeground" Value="White"/>
|
||||
<Setter Property="NonClientAreaForeground" Value="White"/>
|
||||
<Setter Property="CloseButtonForeground" Value="White"/>
|
||||
<Setter Property="Content">
|
||||
<Setter.Value>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Path x:Name="PART_Image" HorizontalAlignment="Center" Visibility="Collapsed" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" Margin="20,32,0,0" Width="30" Height="30" Stretch="Uniform"/>
|
||||
<ScrollViewer Grid.Column="1" Grid.Row="0">
|
||||
<TextBlock Margin="10,39,10,10" x:Name="PART_Message" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
</ScrollViewer>
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center">
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Margin="5,0"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Margin="5,0" Background="#262e2f" Style="{StaticResource ButtonPrimary}"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.No" Content="{x:Static langs:Lang.No}" Margin="5,0"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Yes" Content="{x:Static langs:Lang.Yes}" Margin="5,0" Background="#262e2f" Style="{StaticResource ButtonPrimary}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -12,6 +12,7 @@
|
||||
<Button Command="{Binding OpenWindowCmd}" CommandParameter="{x:Static data:MessageToken.BlurWindow}" Content="{x:Static langs:Lang.OpenBlurWindow}"/>
|
||||
<Button Command="{Binding OpenWindowCmd}" CommandParameter="{x:Static data:MessageToken.CustomNonClientAreaWindow}" Content="{x:Static langs:Lang.OpenCustomNonClientAreaWindow}"/>
|
||||
<Button Click="ButtonMessage_OnClick" Content="{x:Static langs:Lang.OpenMessageWindow}"/>
|
||||
<Button Click="ButtonCustomMessage_OnClick" Content="{x:Static langs:Lang.OpenCustomMessageWindow}"/>
|
||||
<Button Click="ButtonCustomContent_OnClick" Content="{x:Static langs:Lang.OpenCustomContentWindow}"/>
|
||||
<Button Name="ButtonMouseFollow" Click="ButtonMouseFollow_OnClick" Content="{x:Static langs:Lang.OpenMouseFollowWindow}"/>
|
||||
<Button Command="{Binding OpenWindowCmd}" CommandParameter="{x:Static data:MessageToken.NoNonClientAreaDragableWindow}" Content="{x:Static langs:Lang.OpenNoNonClientAreaDragableWindow}"/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
using MessageBox = HandyControl.Controls.MessageBox;
|
||||
|
||||
@@ -18,6 +19,19 @@ namespace HandyControlDemo.UserControl
|
||||
MessageBox.Show(Properties.Langs.Lang.GrowlAsk, Properties.Langs.Lang.Title, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
}
|
||||
|
||||
private void ButtonCustomMessage_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show(new MessageBoxInfo
|
||||
{
|
||||
MessageBoxText = Properties.Langs.Lang.GrowlAsk,
|
||||
Caption = Properties.Langs.Lang.Title,
|
||||
Button = MessageBoxButton.YesNo,
|
||||
IconBrushKey = ResourceToken.AccentBrush,
|
||||
IconKey = ResourceToken.AskGeometry,
|
||||
Style = ResourceHelper.GetResource<Style>("MessageBoxCustom")
|
||||
});
|
||||
}
|
||||
|
||||
private void ButtonMouseFollow_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var picker = SingleOpenHelper.CreateControl<ColorPicker>();
|
||||
|
||||
Reference in new issue
Block a user