开发者

wpf binding support save many to many objects

I'm a new to WPF (c#) and trying to work with MVVM.

Here is the challenge that I have:

Suppose I have two listboxs the one containing product names and the other

have product parameters. The product par开发者_StackOverflow中文版ameters is name and value (textbox or checkbox).

User wants to be able:

1.To chose the product and see and edit it's parameters. option to edit some of the parameters and bnot all.

2.To chose several products and edit several parameters for them.

In other words, support one to one, one to many, many to many,many to one.

The listbox is only an idea you can propose other control/s.

How can I do it with binding and is there a good example for it?

Thanks.


<ListBox ItemsSource="{Binding Customers}" x:Name="customersList"/>
    <ListBox x:Name="customersDetails" ItemsSource="{Binding ElementName=customersList,Path=SelectedItems}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <PropertyGrid IsEditable ="{Binding CanEditCustomer}" SelectedItem ="{Binding}"/>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

The first list contains all customers. The second list contains editors for properties of selected customers.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜