[Category("SomeCat")]
[Description("Gets or sets how items are displayed in the ShellListView control.")]
[DefaultValue(View.Details)]
new public View View
{
get { return base.View; }
set
{
System.Diagnostics.Debug.WriteLine("View");
if (value != View.LargeIcon)
{
//Reset these values because they can only be true if LargeIcon is set.
ShowExtraLargeIcons = false;
}
base.View = value;
}
}
private bool m_ShowExtraLargeIcons;
[Category("Appearance")]
[DefaultValue(false)]
public bool ShowExtraLargeIcons
{
get { return m_ShowExtraLargeIcons; }
set
{
if (m_ShowExtraLargeIcons == value)
return;
System.Diagnostics.Debug.WriteLine("Extra");
m_ShowExtraLargeIcons = value;
if (m_ShowExtraLargeIcons)
// Always set view to LargeIcon if ShowExtraLargeIcons is enabled
View = View.LargeIcon;
}
}
我的问题:如果我将视图设置为比LargeIcons别的东西(通过VS 2010的物业经理),则ShowExtraLargeIcons属性遗体虽然它已被设置为False,但的确如此。依赖的属性不会改变
如果将ShowExtraLargeIcons设置为True,则按预期将View属性设置为LargeIcons。
可能有所帮助:在设置ShowExtraLargeIcons后显示Debug-messages(“View”和“Extra”),在设置View之后,它们不是(在设计时设置的)。
你让它变得复杂...也许只是查看属性?你为什么需要布尔事物? – 2011-01-24 16:47:44
现在,我实现了我自己的视图(使用不同的名称),不再需要此布尔值。谢谢:) – torno 2011-01-27 12:01:28