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