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
1590
Wrap the column Header in Xamgrid
posted

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?

Parents
  • 40030
    Suggested Answer
    Offline posted

    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 

Reply Children