RadExpander.IsExpanded Binding

3 posts, 0 answers
  1. Martin Søberg
    Martin Søberg avatar
    10 posts
    Member since:
    Dec 2009

    Posted 11 Feb 2010 Link to this post


    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. Martin Søberg
    Martin Søberg avatar
    10 posts
    Member since:
    Dec 2009

    Posted 11 Feb 2010 Link to this post



    Answer:

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

    a bit odd.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Steve
    Steve avatar
    1 posts
    Member since:
    Nov 2010

    Posted 18 Oct 2013 Link to this post

    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);
       }  
Back to Top