This is a migrated thread and some comments may be shown as answers.

NullReferenceException when navigating away from BulletGraph

1 Answer 113 Views
BulletGraph
This is a migrated thread and some comments may be shown as answers.
Dan Pingel
Top achievements
Rank 1
Dan Pingel asked on 06 Oct 2011, 04:28 PM
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"/>

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 11 Oct 2011, 12:43 PM
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 >>

Tags
BulletGraph
Asked by
Dan Pingel
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or