diff --git a/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs index ff07fee4f..2d09153ef 100644 --- a/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs +++ b/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs @@ -1,4 +1,5 @@ -using Stylet; +using Artemis.Core.DataModelExpansions; +using Stylet; namespace Artemis.UI.Shared { @@ -16,16 +17,16 @@ namespace Artemis.UI.Shared } } - protected virtual void OnDisplayValueUpdated() - { - } + internal override object InternalGuard => null; public override void UpdateValue(object model) { DisplayValue = model is T value ? value : default; } - internal override object InternalGuard => null; + protected virtual void OnDisplayValueUpdated() + { + } } /// @@ -33,11 +34,22 @@ namespace Artemis.UI.Shared /// public abstract class DataModelDisplayViewModel : PropertyChangedBase { - public abstract void UpdateValue(object model); + private DataModelPropertyAttribute _propertyDescription; + + /// + /// Gets the property description of this value + /// + public DataModelPropertyAttribute PropertyDescription + { + get => _propertyDescription; + internal set => SetAndNotify(ref _propertyDescription, value); + } /// /// Prevents this type being implemented directly, implement instead. /// internal abstract object InternalGuard { get; } + + public abstract void UpdateValue(object model); } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs index 6938f7a6f..d36412d6b 100644 --- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs +++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs @@ -39,13 +39,16 @@ namespace Artemis.UI.Shared return; if (DisplayViewModel == null) + { DisplayViewModel = dataModelUIService.GetDataModelDisplayViewModel(DataModelPath.GetPropertyType(), true); + DisplayViewModel.PropertyDescription = DataModelPath.GetPropertyDescription(); + } DisplayValue = GetCurrentValue(); DisplayValueType = DataModelPath.GetPropertyType(); UpdateDisplayParameters(); } - + protected void UpdateDisplayParameters() { DisplayViewModel?.UpdateValue(DisplayValue); diff --git a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.xaml b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.xaml index 83d51002c..a190a550a 100644 --- a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.xaml +++ b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.xaml @@ -1,22 +1,43 @@  + + + + + + + + + + - - + + - + \ No newline at end of file