Defining columns in RadDataGrid causes exception on load

1 Answer 213 Views
DataGrid
William
Top achievements
Rank 1
Iron
William asked on 10 Sep 2021, 02:39 AM

If I comment out the columns section it loads. So how did you guys get to work? Dylan sent me a ChartViewTest project and I dropped this section in replacing the chart (that works) and it still threw and exception so I know it is not a requirements or configuration issue. What am I doing wrong. Running out of time on this eval.  Thanks. 

  xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid" 

     <grid:RadDataGrid AutoGenerateColumns="False"
                                 SelectionMode="Single"
                                 SelectionUnit="Row"                                 
                                 >
                <grid:RadDataGrid.Columns>
                    <grid:DataGridTextColumn Header="Name"/>
                </grid:RadDataGrid.Columns>
            </grid:RadDataGrid>

I get this...

System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize)
   at Telerik.UI.Xaml.Controls.Grid.DataGridColumn.MeasureCellContainer(Double availableWidth, UIElement container)
   at Telerik.UI.Xaml.Controls.Grid.DataGridColumn.MeasureCell(GridCellModel cell, Double availableWidth)
   at Telerik.UI.Xaml.Controls.Grid.RadDataGrid.MeasureHeaderCell(GridHeaderCellModel cell)
   at Telerik.U

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 10 Sep 2021, 12:10 PM

Hello William,

Thank you for the shared code snippet. 

In order to get started using the RadDataGrid, you can merge the Telerik themes ResourceDictionary in the application's Resources:

<Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
                <ResourceDictionary Source="ms-appx:///Telerik.WinUI.Controls/Themes/Generic.xaml"/>
                <!-- Other merged dictionaries here -->
            </ResourceDictionary.MergedDictionaries>
            <!-- Other app resources here -->
        </ResourceDictionary>
    </Application.Resources>

I am also attaching the ChartViewTest project updated to demonstrate how the RadDataGrid can be setup. Do check it out and let me know, if it helps.

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

William
Top achievements
Rank 1
Iron
commented on 10 Sep 2021, 10:12 PM

Far out! That works. Thanks!

Did I miss that?

Vladimir Stoyanov
Telerik team
commented on 15 Sep 2021, 11:28 AM

I am glad to hear that you found the previous suggestion helpful. 

Indeed we have not included this information in the documentation. That said, I prepared a pull request to update the general Getting Started article and also the RadDataGrid one include this.

Of course, feel free to contact us again, if you have any other questions.  

Tags
DataGrid
Asked by
William
Top achievements
Rank 1
Iron
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or