DataGrid Columns & Headers don't update after appearing

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
TaterJuice
Posts: 147
Joined: Thu Mar 16, 2017 5:40 am
Contact:

DataGrid Columns & Headers don't update after appearing

Postby TaterJuice » Tue Aug 06, 2019 7:52 am

I have a datagrid which needs to be built dynamically, so I placed an empty data grid in a page (with AutoGenerateColumns=False), then on page.Loaded, I add columns to the datagrid by dg.Columns.Add().
These new columns do not show up in the datagrid.

So I tried adding the datagrid columns in the page xaml, and I gave each column an x:Name attribute, so on page.Loaded I could change the headers, ie: dgTitleHeader.Header="Rank".
The column headers still do not update.

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: DataGrid Columns & Headers don't update after appearing

Postby JS-Support @Userware » Tue Aug 06, 2019 1:48 pm

Thanks.

Could you please try setting the columns in the constructor if the page rather than the Loaded event ?

Also, can you please try the small showcase app that you get under Visual Stidio when you click File -> New Project -> CSHTML5 Showcase

It contains a sample DataGrid with custom columns.

Regards


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 49 guests

 

 

cron