我继承了ControlDesigner班级MyControlDesigner.
在这个类我需要获取后面的对象ITypeDescriptorContext和IServiceProvider接口,但我不知道如何:(
我需要这两个接口在方法中传递它们,但我无法在任何其他对象中找到它们.
有人能帮帮我吗.
谢谢
最好的问候Bojan
我正在尝试进一步自定义 WPF ListBox 的内置功能,以按组显示项目。
简而言之,如果组内的所有项目都折叠(Visibility属性),我想隐藏组的容器(以及组的标题)。
首先,我有非常简单的代表单个项目的 City 类。此类包括Shown财产。在里面ItemContainerStyle我只是将DataTrigger其设置Visibility为Collapsedif 该属性的值为False。
class City : INotifyPropertyChanged
{
private bool m_Shown = true;
public string Name { get; set; }
public string Country { get; set; }
public bool Shown
{
get
{
return m_Shown;
}
set
{
m_Shown = value;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Shown"));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
Run Code Online (Sandbox Code Playgroud)
这就是我添加样本城市、添加组描述的方法,一切正常。
m_cities = new List<City>
{
new City() { …Run Code Online (Sandbox Code Playgroud)