开发者

Howto assign a XAML object to a property (.NET35, XAML2006)

Inside my XAML I have two custom components:

<gui:CustomerBrowser x:Name="browser" CustomerDetailView="???" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
<gui:CustomerDetails x:Name="details" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
开发者_StackOverflow

I like to assign the second component to a property of the first component but I don't get it. What will the CustomerDetailView attribute need to contain?

The type of CustomerDetailView is the interface ICustomerView which the other component CustomerDetails implements. Using: VS2010, .NET3.5, XAML2006.


Edit: I pretty much expected WPF 3.5 to be used, you could just try a normal binding in that case:

CustomerDetailsView="{Binding ElementName=details}"

(In .NET 4 you could use x:Reference:)

CustomerDetailsView="{x:Reference details}"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜