Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

RelativeSource FindAncestor with a Custom Business Object as the Ancestor Type

$
0
0

I have a Telerik GridView nested inside another GridView.

The outer GridView is bound to a collection of Order entities which is defined in my view model.

The inner GridView is bound to the OrderDetails navigation property (which is a collection of OrderDetail entities) of each Order entity.

In the inner GridView is a ComboBox.  I'm trying to bind the ItemsSource of that ComboBox to a property which is kept in the OrderDetail object.  However, visual studio is rejecting the xaml binding.  

xmlns:bus="clr-namespace:StoreLibrary.DataObjects"

...

<ComboBox SelectedItem="{Binding Item, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Description" Text="{Binding Item.Description}" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type: bus:OrderDetail}}, Path=availableItems}" />

The error I get is this: The name "OrderDetail" does not exist in the namespace "clr-namespace:StoreLibrary.DataObjects"

But it does.  That's exactly where the entity is defined.

Clearly something is wrong with my binding syntax.  Or else my xaml namespace import at the top.

Thanks!




Viewing all articles
Browse latest Browse all 18858


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>