This commit is contained in:
NaBian committed 2021-01-17 12:42:11 +08:00
1 parent 9c9819af12
commit 74eaafc056
2 files changed
+20 -3

No files matched your search

@@ -5,14 +5,13 @@
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs" xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension" xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
xmlns:data="clr-namespace:HandyControlDemo.Data" xmlns:data="clr-namespace:HandyControlDemo.Data"
hc:Dialog.Token="{x:Static data:MessageToken.DialogDemoWindow}"
DataContext="{Binding DialogDemo,Source={StaticResource Locator}}" DataContext="{Binding DialogDemo,Source={StaticResource Locator}}"
Title="{ex:Lang Key={x:Static langs:LangKeys.DialogDemo}}" Title="{ex:Lang Key={x:Static langs:LangKeys.DialogDemo}}"
Width="800" Width="800"
Height="500"> Height="500">
<hc:TransitioningContentControl> <hc:TransitioningContentControl>
<StackPanel Margin="32" VerticalAlignment="Center"> <StackPanel Margin="32" VerticalAlignment="Center">
<Button Content="{ex:Lang Key={x:Static langs:LangKeys.ShowInCurrentWindow}}" Command="{Binding ShowWithTokenCmd}" CommandParameter="{x:Static data:MessageToken.DialogDemoWindow}"/> <Button Content="{ex:Lang Key={x:Static langs:LangKeys.ShowInCurrentWindow}}" Command="{Binding ShowWithTokenCmd}" CommandParameter="{Binding DialogToken,RelativeSource={RelativeSource AncestorType=Window}}"/>
<Button Margin="0,10,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.ShowInMainWindow}}" Command="{Binding ShowWithTokenCmd}" CommandParameter="{x:Static data:MessageToken.MainWindow}"/> <Button Margin="0,10,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.ShowInMainWindow}}" Command="{Binding ShowWithTokenCmd}" CommandParameter="{x:Static data:MessageToken.MainWindow}"/>
</StackPanel> </StackPanel>
</hc:TransitioningContentControl> </hc:TransitioningContentControl>
@@ -1,10 +1,28 @@
namespace HandyControlDemo.Window using System;
using System.Windows;
using HandyControl.Controls;
using HandyControlDemo.Data;
namespace HandyControlDemo.Window
{ {
public partial class DialogDemoWindow public partial class DialogDemoWindow
{ {
public DialogDemoWindow() public DialogDemoWindow()
{ {
InitializeComponent(); InitializeComponent();
var dialogToken = $"{MessageToken.DialogDemoWindow}+{DateTime.Now:yyyyMMddHHmmssfff}";
DialogToken = dialogToken;
Dialog.SetToken(this, dialogToken);
}
public static readonly DependencyProperty DialogTokenProperty = DependencyProperty.Register(
"DialogToken", typeof(string), typeof(DialogDemoWindow), new PropertyMetadata(default(string)));
public string DialogToken
{
get => (string) GetValue(DialogTokenProperty);
set => SetValue(DialogTokenProperty, value);
} }
} }
} }