Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
225
XamDataPresenter set width programmatically
posted

i have a View (view1) inside another View (viewContainer).

if in view1, i have <igDP:Field Name="field1" label="field1" />

and I am trying to set the width of this field programmatically.

by doing this in the view's code behind:

 

DataPresenter1.FieldLayouts[0].Fields["field1"].Settings.CellWidth = 50.  The reason i have to do this is I need to save the width of the fields when the datapresenter was last closed and load it back up with those same fields, so 50 is just an arbitrary number I am testing with.

however, when I do this, my instance of view1 inside viewContainer no longer loads and says "Cound not create an instance of type 'view1'.

 

I have also tried putting the width inside the ViewModel and binding it that way... but that did not work either.

 

Any suggestions?