Click here to Skip to main content
16,017,922 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 8-Nov-13 21:12pm
v2

1 solution

You can use GetValue/SetValue() for attached DependencyProperty, avoid calling the property directly even for normal DependencyProperty
C#
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900