There is a container with automatic positioning of elements. For example, StackPanel or WrapPanel . The collection is filled with data binding. Suppose I delete one of the elements from the container. How to make a smooth move to the new places of the other elements?
- Most likely you will have to write your own control, based on a StackPanel or WrapPanel, and you should already attach such an animation to it. - Arthur Edgarov
- @ArthurEdgarov, why? For this, what, will it be necessary to define some properties new? I thought it was just a style - iRumba
- 2with the help of Interactions from Blend, you can do whatever you want, just go to Expression Blend, select the control you need and drop Interaction.Triggers with the InvokeCommandAction action. You can also put any actions from prism into it, you just need to connect it. This will give you endless possibilities in terms of GUI! Try it easy! - cvvvlad
- Another question you filled out StackPanel data binding? In my opinion, it has no ItemsSource property ... - cvvvlad
- one@cvvvlad, any container can be filled with a binding. You just need to know how :) In the case of the stack panel, you just need to use the ItemsControl and the stack panel as a panel. Are there any other ways than Blend'a? I somehow did not get used to throwing anything through the GUI, I write the whole interface with pens - iRumba
|
1 answer
I can advise you to use the Storyboard class - see the example on msdn . It will allow you to change certain values smoothly, for example, height or width. Regarding the deletion: I would advise a little to expand the View Model and add a couple of methods:
- VisibilityState {get;} property
An article from Microsoft describes the response to mouse hovering. Similarly, you can subscribe to placing Hidden in Visibility and start a smooth decrease in height. At the end you need to put Visibility Collapsed. When setting this property, an object may already be deleted from the collection.
What happens in terms of the model:
- Set VisibilityState to Hidden
- We are waiting until the item becomes Collapsed.
- Remove item from collection
What happens from the user's point of view:
- He performs the action
- The element disappears, and everything else neatly moves.
|