我正在使用Xceed WPF Extended Toolkit中的PropertyGrid。有没有办法可以默认扩展所有属性?实际上,我永远不会要求它们“未扩展”,所以如果“不扩展”(有没有一个词,BTW?)可以被禁用,那就更好了。
答案 0 :(得分:1)
如果你还在寻找一种方法,我自己就明白了。
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.
}
}
}
答案 1 :(得分:0)
如果设置IsCategorized =“ False”,则默认情况下将看到所有属性展开:
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
myurl = 'https://clinicaltrials.gov/ct2/results?term=wound+care'
#grabbing the page
uClient = uReq(myurl)
#content into variable
page_html = uClient.read()
uClient.close()
#clean up the html for the program to read (parsing)
page_soup = soup(page_html, "html.parser")
还可以指定
<xceed:PropertyGrid IsCategorized="False" SelectedObject="{Binding}"/>
禁用除主属性编辑器网格之外的所有其他部分。