❔ basic c# how to inherits toolkit ObservableRecipient when you are already inherit something else ?

13 Replies
Anton
Anton2y ago
you can't inherit from two things
TotechsStrypper
TotechsStrypperOP2y ago
yeah ...
Anton
Anton2y ago
that's it, you just won't be able to look for a different solution
TotechsStrypper
TotechsStrypperOP2y ago
I don't think the toolkit invent this only to use inside VM
Anton
Anton2y ago
use composition if possible
TotechsStrypper
TotechsStrypperOP2y ago
we have multple properties everywhere in code behind
Klarth
Klarth2y ago
You can get around it with the source gens. If you need to go all the way to ObservableValidator, I don't think that's supported but I could be wrong.
Klarth
Klarth2y ago
Klarth
Klarth2y ago
Keep in mind, that adds the entire implementation of ObservableObject and ObservableRecipient into the VM. So if you do this 100 times, you're going to increase binary size a lot. Well, maybe not a "lot", but certainly measurable.
TotechsStrypper
TotechsStrypperOP2y ago
I added those 2 tags but still unable to le me use the class
Klarth
Klarth2y ago
Yeah, if the base type has another INPC implementation, then you're out of luck, AFAIK. If you're only using the messenger, then you can still grab a reference via WeakReferenceMessenger in the ctor and register handlers.
TotechsStrypper
TotechsStrypperOP2y ago
yeah Im currently not looking for that now
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server