Data binding outside the visual tree. Data Context bridging

≡放荡痞女 提交于 2019-11-28 00:07:32
Markus Hütter

you found a good article there by Josh Smith, but it is a little dated. The same guy wrote an even better article about one year later, that covers pretty much the same question but has better answers: Artificial Inheritance Context

There he uses the class DataContextSpy and while I still don't completely get what you are trying to accomplish I'll try to show you how you use it:

<Grid><!-- this is some container where its DataContext has the PlotBrush Property-->
    <Grid.Resources>
        <spy:DataContextSpy x:Key="Spy"/>
    </Grid.Resources>
    <telerik:thisIsYourControl>
        <telerik:SeriesAppearanceSettings.Stroke>
             <Binding Source="{StaticResource Spy}" Path="DataContext.PlotBrush"/>
        </telerik:SeriesAppearanceSettings.Stroke>
    </telerik:thisIsYourControl>
<Grid>

I hope this helps and works for you. I have not used telerik controls before, that's why I can't code a complete example, still hope this covers it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!