This is a migrated thread and some comments may be shown as answers.

RadExpander.IsExpanded Binding

2 Answers 167 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 2
Martin asked on 11 Feb 2010, 07:28 AM

I've just switched to telerik and are replacing my elements.

My problem is that the normal expander works and the telerik doesnt..  I've placed them next to each other in the code, to validate this.

 

<Expander IsExpanded="{Binding Path=IsExpanded}"></Expander> 
 
<Telerik:RadExpander IsExpanded="{Binding Path=IsExpanded}" ></Telerik:RadExpander> 
 

Bound to

private bool _isExpanded = true;  
public bool IsExpanded  
{  
   get { return _isExpanded; }  
   set 
   {  
       _isExpanded = value;  
       //Some code  
   }  

Is this the wrong way to do it?

- Martin

2 Answers, 1 is accepted

Sort by
0
Martin
Top achievements
Rank 2
answered on 11 Feb 2010, 07:36 AM


Answer:

<Expander IsExpanded="{Binding Path=IsExpanded}"  Margin="0" Padding="0"></Expander> 
<Telerik:RadExpander IsExpanded="{Binding Path=IsExpanded, Mode=TwoWay}" ></Telerik:RadExpander> 

a bit odd.

0
Steve
Top achievements
Rank 1
answered on 18 Oct 2013, 03:07 PM
You also forgot that you property should be in a class (View model) that inherit of INotifyPropertyChanged like 
Telerik.Windows.Controls.ViewModelBase and call this.OnPropertyChanged(() => this.IsExpanded);



private
 bool _isExpanded = true;  
public bool IsExpanded  
{  
   get { return _isExpanded; }  
   set 
   {  
       _isExpanded = value;  
       this.OnPropertyChanged(() => this.IsExpanded);
   }  
Tags
Expander
Asked by
Martin
Top achievements
Rank 2
Answers by
Martin
Top achievements
Rank 2
Steve
Top achievements
Rank 1
Share this question
or