开发者

How can I get source property which is binded in Silverlight 4?

开发者 https://www.devze.com 2023-02-01 09:44 出处:网络
Here is an exa开发者_运维技巧mple: <Grid x:Name=\"LayoutRoot\"> <Control Value=\"{Binding Parent.Margins.Top, ElementName=LayoutRoot}\"/>

Here is an exa开发者_运维技巧mple:

<Grid x:Name="LayoutRoot">
  <Control Value="{Binding Parent.Margins.Top, ElementName=LayoutRoot}"/>
</Grid>

I want to get type of the "Top" property to set correct value (null if it's nullable or "empty" parameter). How can I do this?


If you write an IValueConverter, and use that as the Converter for the Binding expression, then inside of the Convert/ConvertBack methods, you should get the value (typed as "object") and you can use GetType() on that to inspect it and decide how you want to act.

0

精彩评论

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