According to Windows Store App guidelines MessagegDialog
isn't good way to confirm delete.
When the app needs to confirm the user's intention for an action that the user has taken, a flyout is the appropriate surface. See Guidelines for flyouts.
Now I've cleaner code...
private async void DeleteItem_Click(object sender, RoutedEventArgs e)
{
MessageDialog md = new MessageDialog("Error");
String result = DbDeletation();
if (result != "OK")
await md.ShowAsync();
}
And more gently solution :)
<Button HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="Show Dialog">
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock>Are your sure you want to delte this?</TextBlock>
<Button Click="DeleteItem_Click"
Content="Delete"
HorizontalAlignment="Right"/>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>