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

Binding visibility to a specific value

2 Answers 73 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Marcelo
Top achievements
Rank 1
Marcelo asked on 03 Dec 2012, 12:52 PM
Hi, 
I would like to know if it is possible to bind the visibility of something (a div, for example) to a specific value in a select. I know I can bind the visibility to a checkbox true/false, but I want something more complicated, like binding different divs to different values of a dropdown... AND using the declarative approach :) I guess I can bind the visibility of the divs to a method that returns something based on the value of the dropdown... right?

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 05 Dec 2012, 09:35 AM
Hi Marcelo,

You can use the invisible binding and hook up to the change event of the DropDownList to set the corresponding ViewModel fields. Please check this example.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Marcelo
Top achievements
Rank 1
answered on 05 Dec 2012, 01:12 PM
Yes, that was my first thought, using a method to set logic. I just wanted to be sure there was not a simpler way (like I said, binding the visibility to a specific value).

 Thank you!.  
Tags
MVVM
Asked by
Marcelo
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Marcelo
Top achievements
Rank 1
Share this question
or