1 year ago
#377017
Tyomios
How to manage each item's margin of item collection?
I dynamic add tab items into tabControl from viewModel. Each new tab item include in a tag property an object, which has status property as enumeration. If object's status is active, I need to change default tab item's margin to another with animation.
I try use dataTrigger in tab item style.
<DataTrigger
Binding="{Binding IsVendorActivated, UpdateSourceTrigger=PropertyChanged}"
Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation
To="0,0,13,1"
Duration="0:0:0.335"
Storyboard.TargetName="Border"
Storyboard.TargetProperty="Margin"/>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
So, binding property is checking all objects in viewModel object's collection, and when one of this objects has active status, it changes all tab item's margin. What another ways may be useful to manage tab item's margin by it tag's status?
wpf
xaml
mvvm
binding
datatrigger
0 Answers
Your Answer