我在我的 WPF 应用程序中使用了来自扩展WPF工具包3.4.0的Propertygrid。我正在使用SelectedObject of PropertyGrid。一切都很好
但是,我如何指示用户在SelectedObject中没有几个字段是由PropertyGrid中的用户强制填写的?,目前我正在模型对象中使用DisplayName属性,如下所示。但这对用户来说并不那么吸引人。可以在DisplayName中以红色显示名称字段,也可以在PropertyGrid?中以粗体显示强制字段的完整名称字段。我是附加图片,以显示我如何实际想要在PropertyGrid。有人能建议怎么做吗?提前谢谢。

[CategoryAttribute("Category Name"),DisplayName("PropertyDisplayName *"), DescriptionAttribute("Property Description")]
public string PropertyName
{
get
{
return _propertyName ;
}
set
{
_propertyName = Value;
NotifyPropertyChanged();
}
}发布于 2018-12-18 08:47:29
编辑PropertyGrid模板。您将发现TrimmedTextBlock名为"_text“,位于PART_Name之下。根据我们的需求,用转换器绑定前台属性,如下所示。
Foreground="{Binding DisplayName, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource mandatoryFieldColorConverter} }"https://stackoverflow.com/questions/53826995
复制相似问题