Code development platform for open source projects from the European Union institutions

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 ...@@ -32,6 +32,7 @@ namespace VECTO3GUI2020.Helper
public interface IMultistageParameterViewModel public interface IMultistageParameterViewModel
{ {
bool IsReadOnly { get; set; }
bool EditingEnabled { get; set; } bool EditingEnabled { get; set; }
object CurrentContent { get; set; } object CurrentContent { get; set; }
object DummyContent { get; set; } object DummyContent { get; set; }
...@@ -63,6 +64,8 @@ namespace VECTO3GUI2020.Helper ...@@ -63,6 +64,8 @@ namespace VECTO3GUI2020.Helper
private Type _underlyingTargetType; private Type _underlyingTargetType;
private readonly string _propertyName; private readonly string _propertyName;
private bool _isReadOnly;
private bool _valueFieldIsEditable;
public MultistageParameterViewModel ( public MultistageParameterViewModel (
string propertyName, string propertyName,
...@@ -192,6 +195,15 @@ namespace VECTO3GUI2020.Helper ...@@ -192,6 +195,15 @@ namespace VECTO3GUI2020.Helper
} }
public bool IsReadOnly
{
get => _isReadOnly;
set
{
SetProperty(ref _isReadOnly, value);
UpdateValueFieldEditable();
}
}
public bool EditingEnabled public bool EditingEnabled
{ {
...@@ -223,6 +235,24 @@ namespace VECTO3GUI2020.Helper ...@@ -223,6 +235,24 @@ namespace VECTO3GUI2020.Helper
} }
OnPropertyChanged(nameof(CurrentContent)); OnPropertyChanged(nameof(CurrentContent));
OnPropertyChanged(nameof(EditingEnabled)); 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 ...@@ -52,7 +52,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
ConsolidatedHeatPumpConfigurationsPassenger.Add(new HeatPumpConfiguration() ConsolidatedHeatPumpConfigurationsPassenger.Add(new HeatPumpConfiguration()
{ {
HeatPumpMode = heatPumpMode, HeatPumpMode = heatPumpMode,
HeatPumpType = heatPumpType HeatPumpType = heatPumpType,
IsReadOnly = true,
}); });
} }
} }
...@@ -193,7 +194,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation ...@@ -193,7 +194,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
HeatPumpConfigurationsPassenger.Add(new HeatPumpConfiguration() HeatPumpConfigurationsPassenger.Add(new HeatPumpConfiguration()
{ {
HeatPumpType = heatPumpType, HeatPumpType = heatPumpType,
HeatPumpMode = heatPumpMode HeatPumpMode = heatPumpMode,
}); });
} }
} }
...@@ -467,6 +468,16 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation ...@@ -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 #region Implementation of ITuple
int ITuple.Length => 2; int ITuple.Length => 2;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<Label x:Name="label1"> <Label x:Name="label1">
<PriorityBinding> <PriorityBinding>
<Binding Path="Label" Converter="{StaticResource NullToUnsetValue}"></Binding> <Binding Path="Label" Converter="{StaticResource NullToUnsetValue}"></Binding>
<Binding Path="GeneratedLabelText"></Binding> <!--<Binding Path="GeneratedLabelText"></Binding>-->
</PriorityBinding> </PriorityBinding>
</Label> </Label>
<CheckBox Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Name="CheckBoxCombo" <CheckBox Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Name="CheckBoxCombo"
...@@ -29,8 +29,9 @@ ...@@ -29,8 +29,9 @@
IsChecked="{Binding EditingEnabled, IsChecked="{Binding EditingEnabled,
Mode=TwoWay}" Checked="CheckBoxCombo_OnChecked"/> 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, <ComboBox x:Name="comboBox" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2 0 2 0" IsTabStop="False"
Converter={StaticResource BooleanToVisibilityConverter}}" IsHitTestVisible="False" Focusable="False" IsEditable="False" Visibility="{Binding Optional,
Converter={StaticResource BooleanToVisibilityConverter}}" IsHitTestVisible="False" Focusable="False" IsEditable="False"
SelectedValue="{Binding PreviousContent, Mode=TwoWay}" SelectedValue="{Binding PreviousContent, Mode=TwoWay}"
ItemsSource="{Binding GeneratedListItems}"> ItemsSource="{Binding GeneratedListItems}">
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
...@@ -40,15 +41,13 @@ ...@@ -40,15 +41,13 @@
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </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" <ComboBox x:Name="comboBoxCurrent" Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2 0 2 0"
SelectedValue="{Binding CurrentContent, SelectedValue="{Binding CurrentContent,
Mode=TwoWay, Mode=TwoWay,
ValidatesOnExceptions=True, ValidatesOnExceptions=True,
ValidatesOnDataErrors=True, ValidatesOnDataErrors=True,
UpdateSourceTrigger=PropertyChanged}" UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding EditingEnabled}" IsEnabled="{Binding ValueFieldIsEditable}"
IsEditable="False"> IsEditable="False">
<ComboBox.ItemsSource> <ComboBox.ItemsSource>
<PriorityBinding> <PriorityBinding>
...@@ -63,9 +62,8 @@ ...@@ -63,9 +62,8 @@
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
<Label x:Name="label2" Grid.Column="4" <Label x:Name="label2" Grid.Column="4"
Content="{Binding DummyContent, Converter={StaticResource SIToUnitStringConverter}}"> Content="{Binding DummyContent, Converter={StaticResource SIToUnitStringConverter}}">
</Label> </Label>
</Grid> </Grid>
</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