Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
905
How can I clear XamDataGrid LoadCustomizations stream
posted

I try to load customizations with LoadCustomizations  method but when XML stream does not match with datasource, it crashes and I could not reset. So I need to turn back state which is before from LoadCustomizations call.

    string customizationFilePath = GetCustomizationFilePath();
                    if (File.Exists(customizationFilePath))
                    {
                        bool error = false;
                        using (FileStream fs = new FileStream(customizationFilePath, FileMode.Open, FileAccess.Read))
                        {
                            //burada grid ile önceden saklanmış özelliği uyuşmayabilir bu durumda dosyayı loglayıp sileriz.
                            try
                            {
                                LoadCustomizations(fs);
                            }
                            catch
                            {
                                error = true;
                                //Burada hiçbirşey yapmayacak.
                            }
                        }
                        if (error)
                        {
                            File.Delete(customizationFilePath);
                            ClearCustomizations(CustomizationType.All);
                        }
                    }