Hi,
In v10.3, we've been setting the caption (depending on the language selected) at runtime as suggested in one of the posts I've seen on this website.
Been thinking if we could ditch this way of doing things.
I am trying out v22.2 but the column name still changes randomly in the designer. In my case:
but the resulting change does not get updated in the resx file automatically :
Hence, my question, what is the best practice to localize ultragrids? Can we not just put the relevant caption in the language's resX file and let the magic be done by itself as is the case with other controls?
Changing the form language and inserting the captions is not really an option, since we are using the Multilingual App Toolkit to manage the translations. The captions get written over on each build.
Thanks,
Veevek
Hello Veevek,
Thank you for contacting . In the WinGrid Columns keep on changing name in the designers file after reset the datasource is expected . It has a reason , we cant restore the old name, as we are not using the old objects. The DataSource property is being reset which removes the existing UltraGridColumns and then assigned to the BindingSource again, which creates new UltraGridColumns. Since these are new columns and dont match the existing cached columns, the serializer must come up with new names for each column.
Said that , in order to localize the grid column header you would have to give column some caption and use that caption as a resource string . and If the column.Header.Caption is blank (not set), then the control falls back to displaying the Key.
Refer to this post discussing the same matter:
https://es.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/69046/how-do-i-localize-bound-grid-headers
Hi Divya,
Thanks for your response.
Just to be clear, no manipulation was done on the bindingsource once it was set. At times even opening and closing the designer of the form makes a change in column's variable name. Like in this case, no intervention was done on the binding source and yet:
I was wondering whether there is a way for the designer to generate something like [UltraGridName] + _ + [Column Key] e.g.: 'MyUltraGrid_Age' instead of 'ultraGridColumn + [Random number]' ?
Also, is there any best practice for binding data to an Ultragrid?
Without manipulating the datasource I was not able to reproduce the behavior you described.
Here is my test sample . You can open the sample and check the Form1.Designer.cs file, now open and close designer file like you are saying multiple time , I don’t see column name variable changed.
May be share your sample or modify my to reproduce the scenario.
As explained by the control developer in the post , designer would generate column name automatically.
And in the resx file column header caption or key would be saved.
Regarding binding data to the grid ,can you explain question little bit more .
See it depend on the requirement of which kinda of datasource you need (if this is what you are asking), may be this post can answer you question:
https://es.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/105608/populating-a-ultradatasource-and-best-practices
Test1Sample.zip
Not able to attach the video here , tried multiple time.
Recording #72.zip
I followed your instruction and in my sample i set grid dock to fill to none and i am not able to reproduce the behavior you described. attached a small video of my testing.
May i know which version of control you are using ?
Although that is not the point ,if for some reason grid column name changed ,its expected and for the reason i explained above. I had this issue logged long back into our internal bug tracking system and developer explained that its due to serialization.
Here the point is you shouldnt relies on it to set the resource string.
Infra22.2Test.rar
I opened your solution, docked and undocked the ultragrid and the column name variables changed too:
Hello,
You can delete the bin folder from the zip file and try to attach again.
Also make sure to provide the steps to reproduce the issue.