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

IsExpanded = false doesn´t work in ViewModel

1 Answer 57 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Nelson
Top achievements
Rank 1
Nelson asked on 16 Aug 2011, 10:34 AM
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.

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 18 Aug 2011, 01:25 PM
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.

Regards,
Petar Mladenov
the Telerik team

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

Tags
Expander
Asked by
Nelson
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or