Hi
I have a custom style for the BarItemControlTemplate, I'm trying to find the Grid element via code, but the FindName always return null. My goal is to be able to find the ScrollViewer element with in this template so that i can add a event handler for the ScrollChanged event.
I have a custom style for the BarItemControlTemplate, I'm trying to find the Grid element via code, but the FindName always return null. My goal is to be able to find the ScrollViewer element with in this template so that i can add a event handler for the ScrollChanged event.
private void OnBreadCrumbControlCurrentItemChanged(object sender, RadRoutedEventArgs e){ var breadcrumb = sender as RadBreadcrumb; if (breadcrumb != null) { var grid = breadcrumb.BarItemControlTemplate.FindName("Grid", breadcrumb.CurrentContainer) as Grid; grid = breadcrumb.BarItemControlTemplate.FindName("Grid", breadcrumb) as Grid; }}<Style x:Key="RadBreadcrumbStyle" TargetType="{x:Type telerik:RadBreadcrumb}"> <Setter Property="BarItemControlTemplate"> <Setter.Value> <ControlTemplate TargetType="{x:Type telerikNavigation:RadBreadcrumbBarItem}"> <Grid x:Name="Grid"> <Border x:Name="headerContainer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> <telerik:RadSplitButton x:Name="SplitButton" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Command="telerikNavigation:RadBreadcrumbCommands.ClearSelectedItem" Foreground="{TemplateBinding Foreground}" IsOpen="{Binding IsPopupOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" InnerCornerRadius="0" Margin="0" Style="{TemplateBinding SplitButtonStyle}"> <telerik:RadSplitButton.DropDownContent> <ScrollViewer x:Name="ScrollViewer" BorderThickness="0" HorizontalScrollBarVisibility="Auto" MaxWidth="270" MinWidth="200" Padding="0" MaxHeight="200" VerticalScrollBarVisibility="Auto"> <Grid> <Grid HorizontalAlignment="Left" Width="32"> <Border BorderBrush="Transparent" BorderThickness="0,0,1,0" Background="#FF848484" HorizontalAlignment="Right" Width="2"/> <Rectangle Fill="#FFF0F0F0" Margin="0,0,2,0"/> </Grid> <ItemsPresenter Margin="3"/> </Grid> </ScrollViewer> </telerik:RadSplitButton.DropDownContent> </telerik:RadSplitButton> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="HasItems" Value="False"> <Setter Property="DropDownIndicatorVisibility" TargetName="SplitButton" Value="Collapsed"/> </Trigger> <Trigger Property="IsLinearMode" Value="True"> <Setter Property="DropDownIndicatorVisibility" TargetName="SplitButton" Value="Collapsed"/> </Trigger> <Trigger Property="IsButtonPartHidden" Value="True"> <Setter Property="IsButtonPartVisible" TargetName="SplitButton" Value="False"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter></Style>