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

Column Order Resets within TabControl

3 Answers 52 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 03 Jun 2013, 03:52 PM
Hi. I have a RadGridView that is being used within a TabControl. I noticed that if I reorder the columns of the grid, switch to a different tab in the tab control, and then return the tab with the grid, the grid's column order resets back to it's original order. Is there a way to prevent this?

Here is an example layout with the problem:

<Grid x:Name="LayoutRoot" Background="White">
    <controls:TabControl>
        <controls:TabItem Header="Tab 1">
            <telerik:RadGridView>
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="Column 1"/>
                    <telerik:GridViewDataColumn Header="Column 2"/>
                    <telerik:GridViewDataColumn Header="Column 3"/>
                    <telerik:GridViewDataColumn Header="Column 4"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </controls:TabItem>
        <controls:TabItem Header="Tab 2">
            <telerik:RadGridView >
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="Column 1"/>
                    <telerik:GridViewDataColumn Header="Column 2"/>
                    <telerik:GridViewDataColumn Header="Column 3"/>
                    <telerik:GridViewDataColumn Header="Column 4"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </controls:TabItem>
    </controls:TabControl>
</Grid>

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 04 Jun 2013, 11:12 AM
Hello Brian,

The reason for this is that the tab control does not preserve its contents when changing tabs. 
Unfortunately this is a limitation of Microsofts TabControl. You can however use the RadTabControl and set the IsContentPreserved property to true.

Hope this helps! 

Regards,
Nik
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Brian
Top achievements
Rank 1
answered on 04 Jun 2013, 02:22 PM
Thanks for the response. I understand a tab's content is reloaded between tabs, but this was not an issue with the stock silverlight data grid.

Are there performance implications when using IsContentPreserved=true on the RadTabControl? Does this remove the single content presenter optimization or is the state preserved another way that doesn't increase memory usage? I did not find an answer to this in the documentation.

Thanks
0
Nick
Telerik team
answered on 06 Jun 2013, 01:02 PM
Hi Brian,

The performance impact should be positive rather than negative(depending on the weight of the tab contents). The cons of the usage of the properties is that the tab content is not unloaded when switching between tabs, which can lead to a bigger memory consumption. 
As to the Silverlight data grid, Microsoft has solved the issue by inner logic of their own that we don't have access to, and the equivalent is the mentioned property.

Hope this makes sense! 

Regards,
Nik
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Brian
Top achievements
Rank 1
Answers by
Nick
Telerik team
Brian
Top achievements
Rank 1
Share this question
or