开发者

Passing user control object to another object as dependency property

开发者 https://www.devze.com 2022-12-19 16:36 出处:网络
My xaml is as follows: <m:Map CredentialsProvider=\"XXX\" x:Name=\"mainMap\"/> <BingEditableMapControl:BingMapEditingControl BingMap=\"mainMap\" />

My xaml is as follows:

<m:Map CredentialsProvider="XXX" x:Name="mainMap"/>
<BingEditableMapControl:BingMapEditingControl BingMap="mainMap" />

For BingEditableMapControl, the property BingMap is a dependency property takes the control of Map. 开发者_C百科How do i pass the mainMap to the BingMap property through xaml?


Try it like this:-

<m:Map CredentialsProvider="XXX" x:Name="mainMap"/>
<BingEditableMapControl:BingMapEditingControl BingMap="{Binding ElementName=mainMap}" />


Make mainMap a static resource and bind the BingMap property like this

BingMap={StaticResource mainMap}

0

精彩评论

暂无评论...
验证码 换一张
取 消