Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit abb52b9b authored by Harald Martini's avatar Harald Martini
Browse files

Added Readonly property to MultistageParameter

parent 1817e27d
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ namespace VECTO3GUI2020.Helper
public interface IMultistageParameterViewModel
{
bool IsReadOnly { get; set; }
bool EditingEnabled { get; set; }
object CurrentContent { get; set; }
object DummyContent { get; set; }
......@@ -63,6 +64,8 @@ namespace VECTO3GUI2020.Helper
private Type _underlyingTargetType;
private readonly string _propertyName;
private bool _isReadOnly;
private bool _valueFieldIsEditable;
public MultistageParameterViewModel (
string propertyName,
......@@ -192,6 +195,15 @@ namespace VECTO3GUI2020.Helper
}
public bool IsReadOnly
{
get => _isReadOnly;
set
{
SetProperty(ref _isReadOnly, value);
UpdateValueFieldEditable();
}
}
public bool EditingEnabled
{
......@@ -223,6 +235,24 @@ namespace VECTO3GUI2020.Helper
}
OnPropertyChanged(nameof(CurrentContent));
OnPropertyChanged(nameof(EditingEnabled));
UpdateValueFieldEditable();
}
}
public bool ValueFieldIsEditable
{
get => _valueFieldIsEditable;
private set => SetProperty(ref _valueFieldIsEditable, value);
}
private void UpdateValueFieldEditable()
{
if (IsReadOnly) {
ValueFieldIsEditable = false;
return;
} else {
ValueFieldIsEditable = EditingEnabled;
}
}
......
......@@ -52,7 +52,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
ConsolidatedHeatPumpConfigurationsPassenger.Add(new HeatPumpConfiguration()
{
HeatPumpMode = heatPumpMode,
HeatPumpType = heatPumpType
HeatPumpType = heatPumpType,
IsReadOnly = true,
});
}
}
......@@ -193,7 +194,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
HeatPumpConfigurationsPassenger.Add(new HeatPumpConfiguration()
{
HeatPumpType = heatPumpType,
HeatPumpMode = heatPumpMode
HeatPumpMode = heatPumpMode,
});
}
}
......@@ -467,6 +468,16 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
});
}
public bool IsReadOnly
{
get => HeatPumpModeVM.IsReadOnly && HeatPumpTypeVM.IsReadOnly;
set
{
HeatPumpTypeVM.IsReadOnly = value;
HeatPumpModeVM.IsReadOnly = value;
}
}
#region Implementation of ITuple
int ITuple.Length => 2;
......
......@@ -20,7 +20,7 @@
<Label x:Name="label1">
<PriorityBinding>
<Binding Path="Label" Converter="{StaticResource NullToUnsetValue}"></Binding>
<Binding Path="GeneratedLabelText"></Binding>
<!--<Binding Path="GeneratedLabelText"></Binding>-->
</PriorityBinding>
</Label>
<CheckBox Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Name="CheckBoxCombo"
......@@ -29,8 +29,9 @@
IsChecked="{Binding EditingEnabled,
Mode=TwoWay}" Checked="CheckBoxCombo_OnChecked"/>
<ComboBox x:Name="comboBox" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2 0 2 0" IsTabStop="False" Visibility="{Binding Optional,
Converter={StaticResource BooleanToVisibilityConverter}}" IsHitTestVisible="False" Focusable="False" IsEditable="False"
<ComboBox x:Name="comboBox" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2 0 2 0" IsTabStop="False"
Visibility="{Binding Optional,
Converter={StaticResource BooleanToVisibilityConverter}}" IsHitTestVisible="False" Focusable="False" IsEditable="False"
SelectedValue="{Binding PreviousContent, Mode=TwoWay}"
ItemsSource="{Binding GeneratedListItems}">
<ComboBox.ItemTemplate>
......@@ -40,15 +41,13 @@
</ComboBox.ItemTemplate>
</ComboBox>
<!--SelectedIndex="{Binding EditingEnabled, ElementName=MultistageParameterControl, Converter={StaticResource BoolToIntConverter}}"-->
<!--ItemsSource="{Binding ListItems, ElementName=MultistageParameterControl}"-->
<ComboBox x:Name="comboBoxCurrent" Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2 0 2 0"
SelectedValue="{Binding CurrentContent,
Mode=TwoWay,
ValidatesOnExceptions=True,
ValidatesOnDataErrors=True,
UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding EditingEnabled}"
IsEnabled="{Binding ValueFieldIsEditable}"
IsEditable="False">
<ComboBox.ItemsSource>
<PriorityBinding>
......@@ -63,9 +62,8 @@
</ComboBox.ItemTemplate>
</ComboBox>
<Label x:Name="label2" Grid.Column="4"
Content="{Binding DummyContent, Converter={StaticResource SIToUnitStringConverter}}">
Content="{Binding DummyContent, Converter={StaticResource SIToUnitStringConverter}}">
</Label>
</Grid>
</Grid>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment