hi ,
In our Silverlight application we are dynamically showing database results in the Xamgrid.Sometime we will dynamically add the columns or we will show Autogenerate columns based on our database results.We had kept column width as Auto. Our Database results are having longer column names, but the value will be two digit number. So it is occupying the more space unnecessarily.So we want to wrap the column Names to next line.
Could you please let me know how can I achieve this?
Hi,
Assuming the header text is just the key of the column (which it would be in an AutoGenerate situation),
Then you can just use the ColumnsHeaderTemplate property of the xamGrid to set a custom DataTemplate. In there you can put a TextBlock with TextWrapping on:
It should look something like this: <TextBlock TextWrapping="Wrap" Text="{Binding}"/>
Hope this helps,
-SteveZ
Hi SteveZ,Even in the case of Auto generated columns whether I need to create custom datatemplate? Because my application is completely dynamic so I am binding the Xamgrid with Dictionary<string, object> collection. Just for column header wrap it creates a big change.Please let me know the solution to resolve.
Thanks
Anil Kumar