Page 1 of 1

How to bind to add/remove grid columns from ViewModel

Posted: 05 Sep 2014, 15:02
by martinj
Hi,

I'm designing a UserControl that uses a Grid to layout its visual sub elements.
I'd like to have a Model that describes the number of visual elements to be displayed and a ViewModel that makes that happen.

I'm not sure how to proceed. I cannot see any way to bind to the Columndefinition collection, and I'm not really sure how I to do this otherwise.

I found an approach here:
http://rachel53461.wordpress.com/2011/0 ... roperties/
Is this possible in Noesis today? (seems overly complex for such a simple task?)

Re: How to bind to add/remove grid columns from ViewModel

Posted: 09 Sep 2014, 15:45
by sfernandez
Hi,

I'm curious how will you assign to each sub-element its corresponding Grid.Row and Grid.Column. Maybe you already have code in your UserControl where you can manage the collection of columns and rows, and add/remove them accordingly.

Anyway, it shouldn't be a problem to implement a similar approach to the one exposed in your link. I will help you with these task if you find any problems.

Re: How to bind to add/remove grid columns from ViewModel

Posted: 10 Sep 2014, 14:42
by martinj
Thanks for the answer. I got it working, but decided to take another approach. I'll probably get back to you when I get a bit further down that path :)