Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
XamDataGrid with XamComboEditor and filtering
posted

Hi:

I'm trying to implement what seems like it would be a common scenario, but I can't find a straightforward example. If such an animal exists, feel free to point me to it.

I need to bind a XamDataGrid with some of its cells containing a XamComboEditor with the XamComboEditor's ItemFilter set to Contains. 

My window's datacontext is set to my viewmodel. My viewmodel exposes properties for:

IEnumerable<Thing> ThingList

IEnumerable<Model> ModelList

Model CurrentModel

Thing -- the items to which the grid will be bound -- has properties for:

string Name

string ModelId

DateTime ShippedDate

Model has properties for:

string Id

string Name

So... I need to bind the grid to ThingList. I've set DataSource="{Binding Path=ThingList}" in the grid's definition in XAML and that binds like I'd expect. The auto-generated columns (which I'll need to get rid of) display fine and show Thing's ModelId as a string.

I need the Thing's ModelId column to display a XamComboEditor bound to ModelList with the appropriate settings (or the equivalents) for DisplayMemberPath, SelectedValuePath, SelectedItem, and SelectedValue.

I have this working in a single record scenario with a XamComboEditor defined as:

<ig:XamComboEditor x:Name="myThingList" Grid.Column="1" Grid.Row="1" Height="20" ItemsSource="{Binding Path=ModelList}" DisplayMemberPath="Name"  SelectedValuePath="Id" SelectedItem="{Binding CurrentModel}" Padding="4,0" SelectedValue="{Binding Path=CurrentModel.Id}" />

(Also, I had  to define the Contains filter in the code behind. I think I can move that into the XAML by adding xmlns:igDm="http://infragistics.com/DataManager" since the code behind told me I was missing that reference when I used the code from another example. We'll see.)

Any help would be appreciated.

Thanks,

Mark

Parents Reply Children
No Data