best way to implementation this UI?

70 views Asked by At

one button with wrapped list view

my searched result are:

1.worst approach: put add button on the wrapped list view.

2.bad approach: set two data template for list view.

3.?

thanks

1

There are 1 answers

5
CKII On BEST ANSWER

I've had something similar a while back. In the end I decided to add a fake data item where I needed the button.

Say I had a list of MyDataItem, I created a derived class MyFakeDataItem and added that at the end of the list, after I finished populating it. In the WPF I created two data templates, one for each class, and a selected to decide.

I think it turned out quite elegant, since it allowed me to easily override any real functionality I had on MyDataItem, and add a command on the fake one to suit my needs.

Hope that helps.