I am trying to obtain the <RowDefinitions> element from my Xaml, through Javascript, so I can add new <RowDefinition> elements to it at runtime.
This way, if a user inputs the number ’20’, then 20 <RowDefinition> elements will be added to <RowDefinitions>.
The problem is that <RowDefinitions> does not have a possibility for x:Name. It only has x:uid. So would it be possible to fetch the uid from within Javascript? I need the <RowDefinitions> Element one way or another (but only through JS). I need to add <RowDefinition> elements to it.
Any ideas?
Thanks
Assuming Javascript API
There is no such element as
<RowDefinitions>you will be refering to theRowDefinitionsproperty of aGridelement which is represented as<Grid.RowDefinitions>in Xaml. Hence you use FindName to aquire theGridthen useGetValueto get the collection of row definitions. Lets assume you have this simple Xaml to start with:-So in your Javascript you have can have this code:-
This will get the
RowDefinitionscollection from theGrid(which in this case is the sender but you just as easily have usedFindNameto get a named grid. Then it loops adding 20RowDefintioninstances ot the collection.