You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working with WPF .NET6 and I am trying to create a MahApp dialog for a delete confirmation using ReactiveUI / ReactiveCommand/ Interaction.
I have Kent's book and want to include example 1 with chapter09.
When I delete, the following message is generated in the class.
System.InvalidCastException: "Unable to cast object of type 'System.Windows.Navigation.NavigationWindow' to type 'MahApps.Metro.Controls.MetroWindow'."
Please for help.
Thanks
public static class UserControlExtensions
{
public static IObservable ShowMessage(
this UserControl @this,
string title,
string message,
MessageDialogStyle style = MessageDialogStyle.Affirmative,
MetroDialogSettings settings = null)
{ var window = (MetroWindow)Window.GetWindow(@this);
return window
.ShowMessageAsync(title, message, style, settings)
.ToObservable();
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello forum,
I am working with WPF .NET6 and I am trying to create a MahApp dialog for a delete confirmation using ReactiveUI / ReactiveCommand/ Interaction.
I have Kent's book and want to include example 1 with chapter09.
When I delete, the following message is generated in the class.
System.InvalidCastException: "Unable to cast object of type 'System.Windows.Navigation.NavigationWindow' to type 'MahApps.Metro.Controls.MetroWindow'."
Please for help.
Thanks
public static class UserControlExtensions
{
public static IObservable ShowMessage(
this UserControl @this,
string title,
string message,
MessageDialogStyle style = MessageDialogStyle.Affirmative,
MetroDialogSettings settings = null)
{
var window = (MetroWindow)Window.GetWindow(@this);
return window
.ShowMessageAsync(title, message, style, settings)
.ToObservable();
}
}
<rxui:ReactiveUserControl
public partial class ArticleView : ReactiveUserControl
{
}
public class ArticleMainViewModel : ReactiveObject, IDisposable
{
Beta Was this translation helpful? Give feedback.
All reactions