Replies: 3 comments 1 reply
|
It seems the datacontext is not available to the frameworkelementfactory. However, I think there is a simple workaround using selectors:
|
|
I think I got it working using reflection to assign _knownTypeFactory. Then installing a data template is as easy as |
|
I found a cleaner solution: create (the hard way) a FrameworkElementFactory containing a ContentControl whose Content property is bound to whatever with a converter that calls the delegate. |
Uh oh!
There was an error while loading. Please reload this page.
The current template system is taylored for use in xaml and horribly cumbersome in a programmatic context.
How about adding to FrameworkElementFactory a constructor taking as argument a
Func<object, FrameworkElement>, that would be called with the datacontext as argument when generating a control?All reactions