完成数据绑定
This commit is contained in:
parent
e25c2cd3d9
commit
7e19e55e39
@ -26,7 +26,7 @@
|
||||
<ResourceDictionary Source="Resources\Styles\WindowStyle.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="TextBox"
|
||||
BasedOn="{StaticResource MaterialDesignTextBox}">
|
||||
BasedOn="{StaticResource MaterialDesignFilledTextBox}">
|
||||
<!-- 禁用自动化属性,避免 null 报错 -->
|
||||
<Setter Property="AutomationProperties.Name"
|
||||
Value="" />
|
||||
|
||||
@ -178,7 +178,7 @@ namespace BOB.ViewModels.Dialogs
|
||||
{
|
||||
Device = new();
|
||||
IsAdd = true;
|
||||
Device.Type = "TCP";
|
||||
Device.Type = "Tcp";
|
||||
SelectionChanged();
|
||||
}
|
||||
else
|
||||
|
||||
@ -18,7 +18,12 @@ namespace BOB.ViewModels
|
||||
get => _SelectedStep;
|
||||
set => SetProperty(ref _SelectedStep, value);
|
||||
}
|
||||
|
||||
private ProgramModel _Program;
|
||||
public ProgramModel Program
|
||||
{
|
||||
get => _Program;
|
||||
set => SetProperty(ref _Program, value);
|
||||
}
|
||||
#endregion
|
||||
private GlobalVariables _globalVariables;
|
||||
private IEventAggregator _eventAggregator;
|
||||
@ -29,9 +34,10 @@ namespace BOB.ViewModels
|
||||
_globalVariables= globalVariables;
|
||||
_eventAggregator= eventAggregator;
|
||||
_eventAggregator.GetEvent<EditSetpEvent>().Subscribe(EditSingleSetp);
|
||||
CancelEditCommand = new DelegateCommand(CancelEdit);
|
||||
CancelEditCommand = new DelegateCommand(CancelEdit);
|
||||
SaveStepCommand = new DelegateCommand(SaveStep);
|
||||
_eventAggregator.GetEvent<DeletedStepEvent>().Subscribe(DisposeSelectedStep);
|
||||
Program = _globalVariables.Program;
|
||||
}
|
||||
|
||||
private void DisposeSelectedStep(Guid id)
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
VerticalAlignment="Bottom"
|
||||
Content="参数名称*" />
|
||||
<TextBox Width="120"
|
||||
VerticalAlignment="Bottom"
|
||||
Text="{Binding Parameter.Name}" />
|
||||
</StackPanel>
|
||||
<StackPanel Height="30"
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
<Label Width="60"
|
||||
Content="名称" />
|
||||
<TextBox MinWidth="120"
|
||||
|
||||
Text="{Binding SelectedStep.Name}" />
|
||||
</StackPanel>
|
||||
|
||||
@ -168,7 +169,7 @@
|
||||
<MultiBinding Converter="{StaticResource FilteredParametersConverter}">
|
||||
<Binding Path="Type" />
|
||||
<Binding Path="DataContext.Program.Parameters"
|
||||
RelativeSource="{RelativeSource AncestorType=Window}" />
|
||||
RelativeSource="{RelativeSource AncestorType=UserControl}" />
|
||||
</MultiBinding>
|
||||
</ComboBox.ItemsSource>
|
||||
<ComboBox.ItemTemplate>
|
||||
@ -204,7 +205,7 @@
|
||||
<MultiBinding Converter="{StaticResource FilteredParametersConverter}">
|
||||
<Binding Path="Type" />
|
||||
<Binding Path="DataContext.Program.Parameters"
|
||||
RelativeSource="{RelativeSource AncestorType=Window}" />
|
||||
RelativeSource="{RelativeSource AncestorType=UserControl}" />
|
||||
</MultiBinding>
|
||||
</ComboBox.ItemsSource>
|
||||
<ComboBox.ItemTemplate>
|
||||
@ -286,7 +287,7 @@
|
||||
<ComboBox Height="22"
|
||||
MinWidth="120"
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.Program.Parameters}"
|
||||
ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext.Program.Parameters}"
|
||||
SelectedValue="{Binding VariableName}"
|
||||
SelectedValuePath="Name"
|
||||
Visibility="{Binding IsUseVar, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user