Hello,
I have created a mother page which all the pages heritates from.
The goal of this mother control page is to avoid user to leaves a page if they are editing data inside. Ex: the user is editing data shown in a RadGridView and then he leaves the page before leaving.
The mother page is implemented like this
The variable _isEditing is setted to true when data in the child pages is being edited.
The problem is, when the RadWindow is launched the Window doesn't close if the user clicks on OK, he must click on the small cross in the upper right corner.
Why this happens?
I have created a mother page which all the pages heritates from.
The goal of this mother control page is to avoid user to leaves a page if they are editing data inside. Ex: the user is editing data shown in a RadGridView and then he leaves the page before leaving.
The mother page is implemented like this
public partial class MotherPage : Page
{
protected bool _isEditing;
public MotherPage()
{
InitializeComponent();
}
// S'exécute lorsque l'utilisateur navigue vers cette page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e)
{
if (_isEditing)
{
e.Cancel = true;
RadWindow.Alert(new DialogParameters()
{
Header = "Attention !",
Content = "Vous êtes en cours de modification !" + Environment.NewLine +
"Enregistrer ou annuler vos modifications avant de continuer"
});
}
else
{
base.OnNavigatingFrom(e);
}
}
}
The variable _isEditing is setted to true when data in the child pages is being edited.
The problem is, when the RadWindow is launched the Window doesn't close if the user clicks on OK, he must click on the small cross in the upper right corner.
Why this happens?