How To: Save and load settings with RadGridView for WPF

Friday, April 03, 2009 by Vladimir Enchev | Comments 6

I’ve made small demo on how to save and restore various RadGridView settings using ApplicationSettingsBase.
To turn on this for your grid you can simply set RadGridViewSettings.IsEnabled attached property:

<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:WpfApplication1"
xmlns:ts="clr-namespace:Telerik.Settings" Title="Window1">
<
Grid>
<
Grid.Resources>
<
ObjectDataProvider x:Key="customers"
ObjectType="{x:Type local:NorthwindDataContext}" MethodName="get_Customers">
</
ObjectDataProvider>
</
Grid.Resources>
<
telerik:RadGridView ts:RadGridViewSettings.IsEnabled="True" x:Name="RadGridView1"
ItemsSource="{Binding Source={StaticResource customers}}"/>
</
Grid>
</
Window>


Saved settings are:

  • Sorting
  • Grouping
  • Filtering
  • Frozen columns
  • Columns width and order


Enjoy!

[Download]

6 Comments

  • ofer 19 Nov
    can you provide more details please (how to use it, how to save a different grid for different users etc)
  • Vlad 04 Dec
    Hi ofer,

    You can check this demo for latest version:
    http://demos.telerik.com/wpf/?GridView/SaveLoadSettings

    Vlad
  • sandy 17 Jan
    hi Vlad,

    i am using the latest internal build and i donot see radgridviewsetting class nor i see "settings" class in Telerik.Windows.Controls.GridView;

    Please let me know if i am missing ath here.

    thanks,
    sandy
  • Vlad 18 Jan
    Hi Sandy,

    This class can be found in the posted demo. We have problems with our WPF examples code-viewer and you can check the Silverlight version of RadGridViewSettings.cs (exactly the same):
    http://demos.telerik.com/silverlight/#GridView/SaveLoadSettings

    Vlad
  • MP 02 Apr
    Can you share details for a similar setting for Winforms?
  • Petko 27 Oct
    Hello,
    This is very helpful article but can you tell me how to use this RadGridView settings? Do I need some references or plug-ins? 
    I don't have something like that available in my Visual Studio.
    Thanks in advance

Add comment

  1. Formatting options
       
     
     
     
     
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)