The trap I hit responded to ContentDialogResult as follows:
ContentDialogResult result = await cldEdit.ShowAsync();
if (result == ContentDialogResult.Primary)
{
DoTextChange();
}
Instead, ignore the result and call your event-based function.
, KeyUp PrimaryButtonClick:
private void txtEdit_KeyUp(object sender, KeyRoutedEventArgs e)
{
switch (e.Key) {
case Windows.System.VirtualKey.Enter:
if (cldEdit.IsPrimaryButtonEnabled) {
cldEdit.Hide();
DoTextChange();
}
break;
case Windows.System.VirtualKey.Escape:
cldEdit.Hide();
break;
}
}
private void cldEdit_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
DoTextChange();
}