Current filter:
                                You should refresh the page.
                                  • Manage to check for changes when user changes between tabs and ask for action. When the user clicks on "No" is it required to allow switching tab without saving but it gets to a weird glich and view is not drawing well.

                                    [C#]
                                    NonPersistent] public class ConfirmationPopup { public ConfirmationPopup(string prompt) { Prompt = prompt; } public string Prompt { get; private set; } } public partial class TheLinWinkDetailViewController : ViewController<DetailView> { LayoutGroup targetPage; TabbedControlGroup targetTab; protected override void OnActivated() { base.OnActivated(); View.ControlsCreated += new EventHandler(View_ControlsCreated); } void View_ControlsCreated(object sender, EventArgs e) { foreach (object item in ((XafLayoutControl)View.Control).Items) { if (item is TabbedControlGroup) { ((TabbedControlGroup)item).SelectedPageChanging += TheLinWinkDetailViewController_SelectedPageChanging; ((TabbedControlGroup)item).SelectedPageChanged += TheLinWinkDetailViewController_SelectedPageChanged; } } } private void TheLinWinkDetailViewController_SelectedPageChanged(object sender, LayoutTabPageChangedEventArgs e) { switch (e.Page.CustomizationFormText) { case "Chart Of Accounts": View.Refresh(); break; } } private void TheLinWinkDetailViewController_SelectedPageChanging(object sender, LayoutTabPageChangingEventArgs e) { if (View.ObjectSpace.IsModified) { if(targetPage == null) { e.Cancel = true; targetPage = e.Page; targetTab = (TabbedControlGroup)sender; View.ObjectSpace.ConfirmationRequired += ObjectSpace_ConfirmationRequired; View.ObjectSpace.Refresh(); } else { View.ObjectSpace.ConfirmationRequired -= ObjectSpace_ConfirmationRequired; targetTab.Parent.Invalidate(); targetPage = null; targetTab = null; } } } private void ObjectSpace_ConfirmationRequired(object sender, ConfirmationEventArgs e) { if(e.ConfirmationType == ConfirmationType.NeedSaveChanges && e.ConfirmationResult == ConfirmationResult.Yes) { View.ObjectSpace.CommitChanges(); targetTab.SelectedTabPage = targetPage; } else if (e.ConfirmationType == ConfirmationType.NeedSaveChanges && e.ConfirmationResult == ConfirmationResult.No) { targetTab.SelectedTabPage = targetPage; } } protected override void OnDeactivated() { base.OnDeactivated(); } }

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,
                                 
                                If I correctly understand your scenario, it is better to show a confirmation window using the Messaging class as shown in the Ways to Show a Confirmation Dialog article. After that, call the IObjectSpace.CommitChanges or IObjectSpace.ReloadObject method based on a user's choice. I modified your example accordingly. Try this approach and let me know whether it helps.
                                 
                                Thanks,
                                Andrey

                                • Raúl Samper 08.20.2019

                                  Great! Worked like a charm!

                                  Thank you so much

                                • Andrey K (DevExpress Support) 08.20.2019

                                  You are welcome!