IsExpanded = false doesn´t work in ViewModel

2 posts, 0 answers
  1. Nelson
    Nelson avatar
    62 posts
    Member since:
    Apr 2011

    Posted 16 Aug 2011 Link to this post

    Hi there,

    I use in my application one RadExpander and what I want is, in my viewModel, change the state of Expander. I want when the user clicks in a button put the RadExpander with IsExpanded property to false, but doesn´t work.

    I did this in my viewModel:

     public void radExpanderAnexo_Expanded(object sender, Telerik.Windows.RadRoutedEventArgs e)
                if (sender != null)
                    AnexosExpander = (RadExpander)e.Source;

    And when I click in a button I want do that:

    private void OnClosed(object sender, WindowClosedEventArgs e)
                if (e.DialogResult == true)
                    AnexosExpander.IsExpanded = false;

    Any help please?

    Thanks in advance.
  2. Petar Mladenov
    Petar Mladenov avatar
    2882 posts

    Posted 18 Aug 2011 Link to this post

    Hello Nelson,

     I can see a code-behind (not ViewModel's code) in your snippets. If you need code behind solution, you can check out the attached project where the ViewModel`s property is changed dynamically ( you can also change the IsExpanded of the RadExpander). If you need ViewModel's code you can use Commands. Please let us know if you need further assistance on this.

    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft R3 2016 release webinar banner
Back to Top