-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make interface Prism.Interactivity.InteractionRequest.IInteractionRequestAware generic. #405
Comments
+1 |
Well, we can't change the interface definition because it would break every single Prism app out there for no real benefit. It's a good API suggestion, but it needs to be done so that it will not break anyone. Think about it a let me know if you come up with anything. |
I don't think it is possible because of interface limitations in language. It will be easier to explicitly implement interface: public abstract class BasePopupWindowViewModel : IInteractionRequestAware {
public Action FinishInteraction { get; set; }
public INotificationImplementer IInteractionRequestAware.Notification { get; set; }
} but it is forbidden by language. Maybe the other day, when some really good-but-breaking changes accumulate there will be new version of Prism incompatible with previous? Or maybe enabling implementing interface member as I wrote will be easier and more valuable for C# developers? I will check later. |
So I've checked C# 7 work list of features and something I wrote one comment earlier might be possible in the future (Covariant return types: Proposal #357). For now I have a workaround (not clean, but working nice with bindings): public abstract class BasePopupWindowViewModel<T> : IInteractionRequestAware
where T : INotification {
private T _customConfirmation;
public T CustomConfirmation {
get { return _customConfirmation; }
set { _customConfirmation = value; }
}
public Action FinishInteraction { get; set; }
public INotification Notification {
get { return _customConfirmation; }
set { _customConfirmation = (T)value; }
}
} |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I propose making IInteractionRequestAware interface generic for convenience with binding to xaml. Now I have something like:
to handle with custom confirmation popups. Bindings looks like:
but xaml cannot resolve property in desing-time, because only INotification properties are visible. I want to write code like:
and make my custom properties visible for binding.
Only change needed is from this:
to this:
and then fix all (2-3) usages of interface.
I cloned source and did it, it doesn't make any test failed.
What do You think about that?
The text was updated successfully, but these errors were encountered: