Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't think you need to write a panel or add behavior to your panel, if you model your classes right what you are trying to do is achievable using ItemsControls with ability to select items (i.e. ListBox) - I am assuming you are using MVVM.</p> <p>The benefit of this approach is that you are not creating and maintaining an additional panel type which you probably don't need. Plus everything in your model and viewmodel can be fully unit tested. I recommend using or extending existing WPF controls and containers whenever possible, however in this case we may get by without it.</p> <p><strong>ViewModel</strong></p> <pre><code>public class ItemsVM { // You can always keep the items sorted based on you business rules public ObservableCollection&lt;ItemModel&gt; Items {get;set;} public ItemVM() { Items = new ObservableCollection&lt;ItemModel&gt;(){ new ItemModel(), new ItemModel() }; } } </code></pre> <p><strong>Model</strong></p> <pre><code>public class ItemModel { public bool IsSelected {get;set;} public ObservableCollection&lt;ItemModel&gt; Items {get;set;} public ItemModel() { Items = new ObservableCollection&lt;ItemModel&gt;(); } } </code></pre> <p><strong>View</strong></p> <pre><code>&lt;ListBox ItemsSource={Binding Items} SelectionMode=Single /&gt; </code></pre> <p>Once the user clicks on one of the items in your ListBox, you should set the IsSelected property of corresponding item in the ItemVM, on this property change, you can add this item to the Items collection of the top element in your list.</p> <p>You have total control over how you would Template your ItemModel, the top item now has an item in the Items collection, that could be shown the way you have in your diagram.</p> <p><strong>Regarding Animation</strong> This could be done either using code-behind or an attached property, the idea is simple, you know where the user clicked on the ListBox and you should be able to get position of the top element in the ListBox, animate the DataTemplate from current click position to the top of the list</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload