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
30
How to change Xamdatagrid column Width when font size changes?
posted

Hi Team,

i am quite new to Infragistics and would like your help to achieve the below mentioned behaviour.

We have various screens on which we have the option to change the font of XamDataGrid based on user preference .

For that what we do is we bind our  Fontsize property to XamdataGrid FontSize property  like below :

<XamDatagrid FontSize = "{Binding Fontsize}"> 

Now problem is Suppose on a screen  when the font size is changed by user from 8 to 32 ( this is max font size), font of all the columns in XamDataGrid are changed according to the value selected by user but as the font increases width of the columns remain same so the value in the columns are truncated.

i want to know some way by which i can fix this truncation , so when XamDataGrid column font changes , may be something like column width changes accordingly so this truncation doesn't happen or any other way out?

How can i resolve this truncation issue as the font size changes considering it is on multiple screens and assuming each screen has around 30-40 columns.

Thanks in Advance.

Parents
No Data
Reply
  • 2480
    Offline posted
    Hello,

     

    Thank you for reaching out.

     

    I have been looking into your question and my suggestion is to call the PerformAutoSize() method on each field after updating the font size, for example:

     

    Random rand = new Random();
    (this.DataContext as ViewModel).FontSize = rand.Next(8, 32);
    foreach (Field field in this.xdg.FieldLayouts[0].Fields)
    {
        field.PerformAutoSize();
    }

     

    Attached you will find a small sample application that demonstrates this. Please, test it on your side and let me know how it behaves.

     

    Sincerely,
    Bozhidara Pachilova
    Associate Software Developer
Children
No Data