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" />
开发者_StackOverflowI 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}"
精彩评论