WP7 Binding to Local Variable

前端 未结 1 2021
逝去的感伤
逝去的感伤 2021-01-13 10:23

I have a UI element whose color I\'d like to set based on a local variable in the page (well actually in a module, but I can move it to the page).

I see in WPF one c

1条回答
  •  天命终不由人
    2021-01-13 11:09

    Ive been jumping from Silverlight to WPF a lot over the last few weeks, so the following idea may or may not fly.

    Does your page have the name property set on it? If not, set it (x:Name="MyPage").

    then you can do:

    Fill="{Binding ElementName=MyPage, Path=MyProperty}"
    

    Give that a try (just off the top of my head)

    0 讨论(0)
提交回复
热议问题