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'm trying to port an application from WPF, and I've run into a situation where I'm not sure whether it's possible to provide the type hints required for compiled bindings. The original control is a panel which is designed work with view-models which fetch data asynchronously. It displays progress during the fetch, and either the data or an error message and a "Reload" button after it completes or fails.
Specific view-models implement the following interface:
the binding compiler thinks that the DataContext of the DockPanel is relative to the DataContext of the AsyncPanel: it doesn't track through to the theme (and arguably shouldn't, because themes can be replaced) to see that the ContentPresenter which displays that DockPanel is setting its DataContext to DataSource.
I can see some workarounds: e.g. remove the explicit DataContext assignments in the theme and bind to PoolsFetcher.Result. Am I correct in thinking that there's no simple way to tell the compiler "The data type to which the content will be bound is IAsyncDataSource?
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
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to port an application from WPF, and I've run into a situation where I'm not sure whether it's possible to provide the type hints required for compiled bindings. The original control is a panel which is designed work with view-models which fetch data asynchronously. It displays progress during the fetch, and either the data or an error message and a "Reload" button after it completes or fails.
Specific view-models implement the following interface:
Then the panel is
with default theme
However, when I try to use it:
the binding compiler thinks that the
DataContext
of theDockPanel
is relative to theDataContext
of theAsyncPanel
: it doesn't track through to the theme (and arguably shouldn't, because themes can be replaced) to see that theContentPresenter
which displays thatDockPanel
is setting itsDataContext
toDataSource
.I can see some workarounds: e.g. remove the explicit
DataContext
assignments in the theme and bind toPoolsFetcher.Result
. Am I correct in thinking that there's no simple way to tell the compiler "The data type to which the content will be bound isIAsyncDataSource
?Beta Was this translation helpful? Give feedback.
All reactions