修改了按钮命令的绑定
This commit is contained in:
@@ -29,14 +29,13 @@ public partial class DeviceDialogViewModel : DialogViewModelBase<DeviceItemViewM
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task Save()
|
||||
private async Task PrimaryButton()
|
||||
{
|
||||
// Here you can add validation logic before closing.
|
||||
await Close(Device);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task Cancel()
|
||||
private async Task CancleButton()
|
||||
{
|
||||
await Close(null);
|
||||
}
|
||||
|
||||
@@ -8,24 +8,16 @@
|
||||
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:vc="clr-namespace:DMS.WPF.ValueConverts"
|
||||
Title="{Binding Title}"
|
||||
CloseButtonText="取消"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonText="{Binding PrimaryButText}"
|
||||
PrimaryButtonCommand="{Binding PrimaryButtonCommand}"
|
||||
CloseButtonCommand="{Binding CancleButtonCommand}"
|
||||
d:DataContext="{d:DesignInstance vmd:DeviceDialogViewModel}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PrimaryButtonClick">
|
||||
<i:InvokeCommandAction Command="{Binding SaveCommand}" />
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="CloseButtonClick">
|
||||
<i:InvokeCommandAction Command="{Binding CancelCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
<ui:ContentDialog.Resources>
|
||||
<ex:EnumBindingSource x:Key="DeviceType"
|
||||
EnumType="{x:Type enums:DeviceType}" />
|
||||
@@ -131,7 +123,7 @@
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource TextBlockSubTitle}" />
|
||||
<TextBox Text="{Binding Device.OpcUaServerUrl}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!-- S7 Specific Properties -->
|
||||
|
||||
@@ -10,23 +10,16 @@
|
||||
xmlns:en="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
Title="{Binding Title}"
|
||||
CloseButtonText="取消"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonText="{Binding PrimaryButText}"
|
||||
PrimaryButtonCommand="{Binding PrimaryButtonCommand}"
|
||||
CloseButtonCommand="{Binding CancleButtonCommand}"
|
||||
Background="#fff"
|
||||
d:DataContext="{d:DesignInstance vmd:VariableDialogViewModel}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PrimaryButtonClick">
|
||||
<i:InvokeCommandAction Command="{Binding PrimaryButtonCommand}" />
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="CloseButtonClick">
|
||||
<i:InvokeCommandAction Command="{Binding CancleButtonCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ui:ContentDialog.Resources>
|
||||
<valueConverts:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||||
</ui:ContentDialog.Resources>
|
||||
|
||||
Reference in New Issue
Block a user