I have a FlipView with some controls in the DataTemplate. Since it’s in a FlipView, it will generate multiple copies of those controls. If I want to find the control that is in the current FlipView view (i.e. on screen / visible), how can I do it?
I can check the loaded event on the control inside but it will be called multiple times and I won’t know which one is being shown.
Create an Attached Dependency Property that you can bind to the RichTextBlock from the ViewModel, such as:
With this property, you can bind it to the ViewModel’s IsSelected property:
When the SelectedItem is changed, you can set IsSelected on the child View Model to true, and that triggers the MyStaticClass.OnVisibilityChanged event.