NullReferenceException when navigating away from BulletGraph

2 posts, 0 answers
  1. Dan Pingel
    Dan Pingel avatar
    5 posts
    Member since:
    May 2010

    Posted 06 Oct 2011 Link to this post

    Hi,

    I'm using a TileView and have a RadHorizontalBulletGraph that I only display when the TileView item is in the maximized state. When I maximize an item, the bullet graph displays correctly, but when I go to minimize the item, I get a NullReferenceException. There's not much of a stack trace, but here it is:

       at System.Windows.StyleHelper.FindNameInTemplateContent(DependencyObject container, String childName, FrameworkTemplate frameworkTemplate)
       at System.Windows.TemplateNameScope.System.Windows.Markup.INameScope.FindName(String name)
       at System.Windows.FrameworkElement.FindName(String name)
       at Telerik.Windows.Controls.ChildrenOfTypeExtensions.GetChildByName(FrameworkElement element, String name) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\Extensions\ChildrenOfTypeExtensions.cs:line 42
       at Telerik.Windows.Controls.BulletGraph.RadBulletGraphBase.ToggleAxis() in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\DataVisualization\BulletGraph\Base\RadBulletGraphBase.cs:line 925
       at Telerik.Windows.Controls.BulletGraph.RadBulletGraphBase.SynchronizeFeaturedMeasures() in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\DataVisualization

    Here's a simplified version of my XAML. Any ideas?
    <DataTemplate x:Key="MachineTileLarge">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <telerik:RadHorizontalBulletGraph Grid.Row="1" Maximum="100"
            ComparativeMeasureBrush="CornflowerBlue" FeaturedMeasureBrush="SeaGreen"
            ComparativeMeasure="32" FeaturedMeasure="75" />
    </Grid>
    </DataTemplate>
    <DataTemplate x:Key="MachineTemplate">
        <telerik:RadFluidContentControl ContentChangeMode="Manual" TransitionDuration="0:0:.5"
            State="{Binding State, Converter={StaticResource tileConverter}}"
            SmallContentTemplate="{StaticResource MachineTileSmall}"
            ContentTemplate="{StaticResource MachineTileNormal}"
            LargeContentTemplate="{StaticResource MachineTileLarge}" />
    </DataTemplate>
     
    <Style TargetType="telerik:RadTileView">
        <Setter Property="PreservePositionWhenMaximized" Value="True" />
        <Setter Property="telerik:TileViewPanel.IsVirtualized" Value="True" />
        <Setter Property="IsAutoScrollingEnabled" Value="True" />
        <Setter Property="TileStateChangeTrigger" Value="SingleClick" />
        <Setter Property="MinimizedColumnWidth" Value="200" />
        <Setter Property="MinimizedRowHeight" Value="225" />
        <Setter Property="RowHeight" Value="330" />
        <Setter Property="ColumnWidth" Value="290" />
        <Setter Property="ContentTemplate" Value="{StaticResource MachineTemplate}" />
        <Setter Property="ItemTemplate" Value="{StaticResource MachineTileHeader}" />
    </Style>
     
    <telerik:RadTileView ItemsSource="{Binding Path=MachineStatusItems}"                                    
         TileStateChanged="tileView_TileStateChanged"
         TileStateChangeTrigger="SingleClick"
         MaximizeMode="ZeroOrOne"
         IsItemDraggingEnabled="True"
         PreservePositionWhenMaximized="True"/>
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 11 Oct 2011 Link to this post

    Hello Dan Pingel,

    We investigated the code that you have provided, but unfortunately couldn't reproduce the mentioned exception. Perhaps the problem is elsewhere in your code. I have attached the sample project we have used in our labs. Can you please take a look at it and check if we have missed something?

    Regards,
    Yavor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top