嗨观众, 我以编程方式 设置属性 。 < contentcontrol width =130> 身高=130 Canvas.Top =150 Canvas.Left =470 Selector.IsSelected =True> 如何以编程方式设置此项。请设置此项我搜索了多个sites.still现在我没有回答。请让我清楚pbm.pls帮助我。
解决方案你可以使用GetValue / SetValue()来连接DependencyProperty,避免直接调用属性for normal DependencyProperty this .SetValue(Selector.IsSelectedProperty,真); 此 .GetValue(Selector.IsSelectedProperty) as bool ;
Selector.IsSelectedProperty是一个附加的DependencyProperty,作为附加属性,Selector定义了IsSelectedProperty和GetIsSelected( )/ SetIsSelected()方法。 如果是正常的DependencyProperty,例如高度属性,然后它定义了HeightProperty和Height属性(带有getter和setter)。 问候 Joseph Leung
Hi Viewers, I have a pbm on programatically set the property isselected=true in content control. <contentcontrol width="130"> Height="130" Canvas.Top="150" Canvas.Left="470" Selector.IsSelected="True"> How to set this programatically.Pls set this i searched many sites.still now i got no answer.pls let me clear the pbm.pls help me.
解决方案 You can use GetValue/SetValue() for attached DependencyProperty, avoid calling the property directly even for normal DependencyProperty this.SetValue(Selector.IsSelectedProperty, true); this.GetValue(Selector.IsSelectedProperty) as bool;Selector.IsSelectedProperty is a attached DependencyProperty, as an attached property, Selector defined both IsSelectedProperty and GetIsSelected()/SetIsSelected() method. If normal DependencyProperty, e.g. Height Property, then it defined the HeightProperty and "Height" property (with getter and setter). Regards Joseph Leung
更多推荐
WPF中的内容控制上的Pbm
发布评论