I have a property grid on my view model (XAML below.) I have the DataObject property bound to a an object on my view (code below.) When my viewmodel is loaded, the DataObject is not shown in the property grid. If I live edit the XAML to delete and then add the binding back, it works fine. It continues to work and update when the DataObject is changed from code behind. It is only during the first load of the view model when it does not work.
<grids:PropertyGrid
x:Name="ctlPropertyEditor"
Margin="0,10,0,0"
DataObject="{Binding Message}"
IsSummaryVisible="False"
IsCategorized="False"
CanClearDataObjectOnUnload="True"
AreReadOnlyPropertiesBrowsable="False"
gridseditors:BuiltinPropertyEditors.IsEnabled="True">
<grids:PropertyGrid.PropertyEditors>
<grids:PropertyEditor PropertyType="numerics:Time">
<grids:PropertyEditor.ValueTemplate>
<DataTemplate>
<editors:TimeSpanEditBox Value="{Binding Value, Converter={StaticResource TimeToTimeSpanConverter}}"/>
</DataTemplate>
</grids:PropertyEditor.ValueTemplate>
</grids:PropertyEditor>
</grids:PropertyGrid.PropertyEditors>
</grids:PropertyGrid>
public class MscCommandBuilderViewModel : NotifyingObject
{
public IMscMessage Message
{
get => _message;
set
{
if (value == _message) { return; }
_message = value;
NotifyOfPropertyChange();
}
}
public MscCommandBuilderViewModel(byte[] data)
{
Message = CreateMessage(data);
}
}