I am attempting to get a reference to the RadCarouselPanel in my RadCarousel. I need to know when it is animating. But unless I wait for some sort of manual event (like a keyboard press) the panel is null.
First I tried adding a handler for the Carousel's Loaded event
Unfortunately the second check fails here. FindCarouselPanel returns null. I guess this makes some sense since the carousel is initially not visible when my page is loaded. So I figured, maybe the carousel waits until it becomes visible to create it's panel
So then I tried to put in a handler for the carousel's IsVisibleChanged event. I figure the carousel will have to have created the panel by then, right?
But no, wrong. The Panel returned here is still null
However If i then set up an event handler for... say... a keyboard event later on, at that point FindCarouselPanel returns a valid panel.
So what are the rules here? How do I determine definitively when the Carousel creates its panel?
Note: I am using The Windows8Touch theme in the binaries with XAML and the StyleManager. I have not created an sort of ControlTemplate for the carousel or its items. I am using the theme-provided ones
First I tried adding a handler for the Carousel's Loaded event
<tk:RadCarousel x:Name="OtherScanGallery"
ItemsSource="{Binding OtherScansView}"
VerticalContentAlignment="Top"
IsSynchronizedWithCurrentItem="True"
IsVisibleChanged="OtherScanGallery_OnIsVisibleChanged"
SelectionChanged="OtherScanGallery_OnSelectionChanged"
Loaded="OtherScanGallery_OnLoaded"
SelectedItem="{Binding ElementName=Root, Path=DataContext.SelectedOtherScan, Mode=TwoWay}"
>
private void OtherScanGallery_OnLoaded(object sender, RoutedEventArgs e)
{
RadCarouselPanel? panel = null;
if (sender is not RadCarousel car)
Log.Debug($"Gallery loaded but no carousel");
elseif (null == (panel = car.FindCarouselPanel()))
Log.Debug($"Gallery loaded but no panel");
else
Log.Debug($"Gallery fully loaded");
}
Unfortunately the second check fails here. FindCarouselPanel returns null. I guess this makes some sense since the carousel is initially not visible when my page is loaded. So I figured, maybe the carousel waits until it becomes visible to create it's panel
So then I tried to put in a handler for the carousel's IsVisibleChanged event. I figure the carousel will have to have created the panel by then, right?
private void OtherScanGallery_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
var panel = OtherScanGallery.FindCarouselPanel();
if (null == panel )
Log.Error("No panel after visible changed.");
}
But no, wrong. The Panel returned here is still null
However If i then set up an event handler for... say... a keyboard event later on, at that point FindCarouselPanel returns a valid panel.
So what are the rules here? How do I determine definitively when the Carousel creates its panel?
Note: I am using The Windows8Touch theme in the binaries with XAML and the StyleManager. I have not created an sort of ControlTemplate for the carousel or its items. I am using the theme-provided ones