Is there a way to pass an EventCallback as a CascadingValue without using internal framework use methods?
See original GitHub issueIssue description
Some methods are described with “For internal framework use only.”
I have been using EventCallback.Factory.Create(Object, EventCallback)
to pass an EventCallback
as a CascadingValue
. This allows me to pass the EventCallback down a few levels without having to pass it explicitly through each razor component between the one with the callback function and the one that will call it.
I recently saw in the documentation it is described by the following:
Returns the provided callback. For internal framework use only.
I assume this means it should not be used or that it can disappear from a future release (with or without notice).
I’ve tried using the other Create
methods in EventCallback.Factory
/EventCallbackFactory
, but haven’t been able to accomplish the same thing without compile errors.
cc: @guardrex
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (12 by maintainers)
Ok that I can’t comment on. Let me edit the title so it’s better and someone might pick it up.
But you might want to describe what you’re trying to do, rather than say “I want this”. For example “Why do you want a cascading value event callback?”, what are you trying to achieve?
@SteveSandersonMS Thank you very much! I got it working with a slight alteration to the second line (due to
MyMethod
taking a parameter of typeMyClass
):I have another one that has a method that returns
Task
and takes no parameters, so I used the following for that one. Putting this here for anyone else who might be unsure about how to handle this case.