これをオブジェクトにバインドすると、基本クラスプロパティが失われます。
<xctk:PropertyGrid x:Name="_propertyGrid"
AutoGenerateProperties="True"
HideInheritedProperties="False"
SelectedObject="{Binding}" >
</xctk:PropertyGrid>
それらを見るために追加する必要があるものは他にありますか? これはコミュニティの追加にあります-v3.0
**update - example more akin to the production code:
<TreeView Name="Containers">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type viewModels:ContainerViewModel}" ItemsSource="{Binding Children}">
<xctk:PropertyGrid
Width="250"
ShowTitle="False"
ShowSummary="False"
AutoGenerateProperties="True"
HideInheritedProperties="False"
SelectedObject="{Binding}"
SelectedObjectName=""
SelectedObjectTypeName="">
</xctk:PropertyGrid>
</HierarchicalDataTemplate>
</TreeView
**更新-基本プロパティをオーバーライドするクラスを検査すると、すべての基本クラスプロパティがプロパティグリッドに表示されないことがわかりました。
今これをさらに調べますが、解決策はありません。
回答:
回答№1は2それらを見るために追加する必要があるものは他にありますか?
プロパティが public
。次は私のために働く。
コード:
public class Base
{
public int Test { get; set; }
}
public class Derived : Base
{
public int Test2 { get; set; }
}
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = this;
}
public Derived Derived { get; } = new Derived();
}
XAML:
<xctk:PropertyGrid x:Name="_propertyGrid"
AutoGenerateProperties="True"
HideInheritedProperties="False"
SelectedObject="{Binding Derived}" >
</xctk:PropertyGrid>
回答№2の場合は-1
継承されたオーバーライドされたプロパティでは、プロパティのオーバーライドで設定または取得のみが提供されました。欠落しているゲッターまたはセッターをオーバーライドされたプロパティに追加すると、問題が修正されます。
public override double Height {
get {
//this get is necessary for the design
}
//adding set is necessary for Height to be visible
set { base.Height = value; }
}