This is a migrated thread and some comments may be shown as answers.

How to enable MeasureTextOnRender?

1 Answer 66 Views
VirtualGrid
This is a migrated thread and some comments may be shown as answers.
HFP
Top achievements
Rank 1
HFP asked on 09 Oct 2017, 09:17 PM

How can (resp. should) I enable the MeasureTextOnRender property?

 

myRadVirtualGrid.MeasureTextOnRender = true;

for (int i = 0; i < myRadVirtualGrid.InitialColumnCount; i++)
{
    myRadVirtualGrid.FitColumnWidthToContent(i);
}

 

It seems to be quite simple, but crashes (unclear exception).

This exception comes from "myRadVirtualGrid.MeasureTextOnRender = true;" only ...

Any idea how to fix it?

Or at least a working example for using the FitColumnWidthToContent method?

Thanks a lot in advance!

Hagen

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 10 Oct 2017, 07:14 AM
Hello Hagen,

We will try to fix this exception as soon as possible. However, you need to use the Loaded event of the VirtualGrid. Please check the following code snippet for a reference:
void vg_Loaded(object sender, RoutedEventArgs e)
     {
         for (int i = 0; i < vg.InitialColumnCount; i++)
         {
             vg.FitColumnWidthToContent(i);
         }
     }

P.S. Your Telerik points were updated.

Regards,
Yoan
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
VirtualGrid
Asked by
HFP
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or