Binding EntranceThemeTransition Grid Properties in MapItemsControl.ItemTemplate Does Not Work

I have a map control with map elements related as follows:

<maps:MapItemsControl ItemsSource="{Binding MapObjects}"> <maps:MapItemsControl.ItemTemplate> <DataTemplate> <Grid maps:MapControl.Location="{Binding Location}" maps:MapControl.NormalizedAnchorPoint="{Binding AnchorPoint}" > <Grid.Transitions> <TransitionCollection> <EntranceThemeTransition FromVerticalOffset="{Binding VerticalOffset}" FromHorizontalOffset="{Binding HorizontalOffset}" /> </TransitionCollection> </Grid.Transitions> ... </Grid> </DataTemplate> </maps:MapItemsControl.ItemTemplate> </maps:MapItemsControl> 

What I wanted to achieve is to make the map elements have a nice animation so that they do not just appear out of nowhere ... In particular, I wanted them to slide into place towards the center of the map.

But this code does not seem to work ... The binding does not even cause a β€œcall” for the two properties of EntranceThemeTransition , and they retain their default values, so each element of the map moves to the right.

Also, when I change the Binding statement to some property that does not exist in my ViewModel: FromVerticalOffset="{Binding NonExistentProperty} , there is no error indicating this, which usually happens and will look something like this: Error: BindingExpression path error: 'NonExistentProperty' property not found on 'IMS_Mobile.ViewModels.MapViewModel+MapItem...'

Can anyone help? Thanks.

+5
source share
1 answer

I do not use MapItemsControl, but maybe it is like ItemsControl. Remove the transition from the ItemTemplate and add it to the map: MapItemsControl.ItemContainerTransitions, as shown below:

 <maps:MapItemsControl ItemsSource="{Binding MapObjects}"> <maps:MapItemsControl.ItemContainerTransitions> <TransitionCollection> <EntranceThemeTransition FromVerticalOffset="{Binding VerticalOffset}" FromHorizontalOffset="{Binding HorizontalOffset}" /> </TransitionCollection> </maps:MapItemsControl.ItemContainerTransitions> <maps:MapItemsControl.ItemTemplate> <DataTemplate> <Grid maps:MapControl.Location="{Binding Location}" maps:MapControl.NormalizedAnchorPoint="{Binding AnchorPoint}" > ... </Grid> </DataTemplate> </maps:MapItemsControl.ItemTemplate> 

0
source

Source: https://habr.com/ru/post/1208216/


All Articles