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

Saving by PersistenceManager but missed Converter and StringFormat

2 Answers 29 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 03 May 2016, 12:43 PM

Hi,

I'm saving by PersistenceMaganer on my GridView but when I try to reload it missed converter and formatstring in some column.

When reloading it doesn't apply Converter called FuoriCorsoConverter and StringFormat of "Last Update" column, durthermore other column with StringFormat is correctly applyed instead.

Why?

Codes:

//Portions of code for saving
PersistenceManager manager = new PersistenceManager();
var streamGridView = manager.Save(this.DocumentHostGridView);
//[...]
 
//Portion of code for loading
//[...]
private void LoadPersonalizzazione()
{
    //Personlizzazione del docking
    var stream = ViewModel.CaricaPersonalizzazione(this.GetType().ToString()); //ref. UserControl.xaml.cs
    if (stream != null)
        this.MainRadDocking.LoadLayout(stream);
 
    //Personalizzazione della gridview principale
    MemoryStream streamGridView = ViewModel.CaricaPersonalizzazioneControllo(this.GetType().ToString(),
        this.DocumentHostGridView.Name);
    if (streamGridView != null)
    {
        streamGridView.Position = 0L;
        PersistenceManager manager = new PersistenceManager();
        manager.Load(this.DocumentHostGridView, streamGridView);
    }
}
//[...]

XAML of columns

<telerik:GridViewDataColumn Header="Last Update" DataMemberBinding="{Binding UltimoAggiornamento, StringFormat={}{0:dd/MM/yyyy}}"/>
<telerik:GridViewImageColumn Header="Out" DataMemberBinding="{Binding FuoriCorso, Converter={StaticResource FuoriCorsoConverter}}"/>

2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 05 May 2016, 12:28 PM
Hello Potito,

I prepared a sample application with which I tried reproducing such malfunction, but to no avail. Can you please check it out? Moreover, can you please share some details on how the implementation differs from the one in your application? It would be quite useful if you can modify the demo project as per your exact project setup, so that the issue can be reproduced, and send it as an attachment in a new support thread.

Regards,
Stefan X1
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 06 May 2016, 06:59 AM

I noticed that you used, I'll try to use this approach

ServiceProvider.RegisterPersistenceProvider<ICustomPropertyProvider>(typeof(RadGridView), new GridViewCustomPropertyProvider());

Tags
GridView
Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Dario Concilio
Top achievements
Rank 2
Share this question
or