C# WPF扩展工具包PropertyGrid-默认情况下展开所有属性
我正在使用Xceed WPF扩展工具包中的PropertyGrid。是否有一种方法可以使所有属性默认展开?事实上,我永远都不需要它们“未扩展”,所以如果“未扩展”(顺便说一句,有没有这个词)可以禁用,那就更好了。如果你还在寻找一种方法来实现这一点,我只是自己想出来的C# WPF扩展工具包PropertyGrid-默认情况下展开所有属性,c#,wpf,propertygrid,wpf-extended-toolkit,C#,Wpf,Propertygrid,Wpf Extended Toolkit,我正在使用Xceed WPF扩展工具包中的PropertyGrid。是否有一种方法可以使所有属性默认展开?事实上,我永远都不需要它们“未扩展”,所以如果“未扩展”(顺便说一句,有没有这个词)可以禁用,那就更好了。如果你还在寻找一种方法来实现这一点,我只是自己想出来的 private void PropertyGrid_SelectedObjectChanged(object sender, RoutedPropertyChangedEventArgs<object> e) {
private void PropertyGrid_SelectedObjectChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
var grid = sender as PropertyGrid;
foreach (PropertyItem prop in grid.Properties)
{
if (prop.IsExpandable) //Only expand things marked as Expandable, otherwise it will expand everything possible, such as strings, which you probably don't want.
{
prop.IsExpanded = true; //This will expand the property.
prop.IsExpandable = false; //This will remove the ability to toggle the expanded state.
}
}
}
private void PropertyGrid\u SelectedObjectChanged(对象发送方,RoutedPropertyChangedEventArgs e)
{
var grid=发送方作为PropertyGrid;
foreach(grid.Properties中的PropertyItem属性)
{
if(prop.IsExpandable)//仅扩展标记为可扩展的内容,否则它将扩展所有可能的内容,例如您可能不需要的字符串。
{
prop.IsExpanded=true;//这将扩展属性。
prop.IsExpandable=false;//这将删除切换展开状态的功能。
}
}
}
如果设置IsCategorized=“False”,则默认情况下会显示展开的所有属性:
<xceed:PropertyGrid IsCategorized="False" SelectedObject="{Binding}"/>
禁用除主属性编辑器网格之外的所有其他部分。我意识到这不是一个实际的答案,但您是否看到Syncfusion正在分发其完整套件。。。这里的好处是,他们有自己的论坛,技术人员可以直接回答问题。我和Syncfusion没有任何关系!我的意思是说Syncfusion包含一个属性网格!
ShowPreview="False" ShowSearchBox="False" ShowSortOptions="False"
ShowSummary="False" ShowTitle="False" ShowAdvancedOptions="False"