0

I'm trying to use telerik:PersistenceManager.StorageId property on RadGridView to persist the component status in the local storage.

If I set the property like this:

telerik:PersistenceManager.StorageId="rgvItems"

all works fine but I would like to set the StorageId dynamically using binding. To do that, I've tried to set the property like this:

telerik:PersistenceManager.StorageId="{Binding Path=StorageId}"

where StorageId is a DependecyProperty defined in the component xaml.cs file:

    public string StorageId
    {
        get
        {
            return (string) GetValue(StorageIdProperty);
        }
        set
        {
            SetValue(StorageIdProperty, value);
        }
    }
    public static readonly DependencyProperty StorageIdProperty = 
        DependencyProperty.Register("StorageId", typeof(string), typeof(vGridContainer));

and set in the component constructor like this:

    public vGridContainer(string storageId)
    {
        InitializeComponent();
        DataContext = this;

        StorageId = ConfigurationManager.AppSettings["PersistenceManager.StorageId"]

        [...]
    }

With that code the grid view status is not persisted.

Am I missing something?

Thank you all in advance :)

Androidian
  • 1,035
  • 1
  • 16
  • 40

1 Answers1

0

I've tried everything about binding property from xaml but nothing worked.

Finally I solved that issues setting the attached dependency property from code like this:

rgvCheckIn.SetValue(Telerik.Windows.Persistence.PersistenceManager.StorageIdProperty, ConfigurationManager.AppSettings["PersistenceManager.StorageId"]);

Now it works fine. Hope that helps anyone that is experiencing the same issue :)

Androidian
  • 1,035
  • 1
  • 16
  • 40