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

NullReferenceException at Telerik.Windows.Controls.RadTreeListView.CanExpandHierarchyItemExecute

5 Answers 85 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Rami Abughazaleh
Top achievements
Rank 1
Rami Abughazaleh asked on 27 Aug 2010, 10:15 PM
Hi.

I need some help trying to track down a bug in my application that I think is coming from a RadTreeListView.

I am still trying to create a reproducible project that I can send.

The basic scenario when the exception occurs is:
1. click on hyperlink button in RadTreeListView row
2. The hyperlink button will display a modal RadWindow
3. press the right arrow key

At the time the key is pressed, it seems that the RadTreeListView row still has focus.
The row in the RadTreeListView is a single child item of the root node that does not have any children of its own.
I am thinking I need to set the correct value for the HasItems property of the child nodes in my tree using a setter, but have not tried that yet.

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)

e.ExceptionObject = {System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Controls.RadTreeListView.CanExpandHierarchyItemExecute(CanExecuteRoutedEventArgs e)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CanExpandHierarchyItemExecute(Object sender, CanExecuteRoutedEventArgs e)
   at Telerik.Windows.Controls.CommandBinding.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
   at Telerik.Windows.Controls.CommandManager.CanExecuteCommandBinding(Object sender, CanExecuteRoutedEventArgs e, CommandBinding commandBinding)
   at Telerik.Windows.Controls.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at Telerik.Windows.Controls.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at Telerik.Windows.Controls.CommandManager.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
   at Telerik.Windows.Controls.CanExecuteRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
   at Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
   at Telerik.Windows.RouteItem.InvokeHandler(RadRoutedEventArgs routedEventArgs)
   at Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
   at Telerik.Windows.EventRoute.InvokeHandlers(Object source, RadRoutedEventArgs args)
   at Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
   at Telerik.Windows.DependencyObjectExtensions.RaiseEvent(DependencyObject element, RadRoutedEventArgs e)
   at Telerik.Windows.Controls.RoutedCommand.CanExecute(Object parameter, UIElement target)
   at Telerik.Windows.Controls.RoutedCommand.System.Windows.Input.ICommand.CanExecute(Object parameter)
   at Telerik.Windows.Controls.TreeListView.TreeListViewKeyboardCommandProvider.AddExpandCommandIfNeeded(IList`1 commandsToExecute)
   at Telerik.Windows.Controls.TreeListView.TreeListViewKeyboardCommandProvider.ProvideCommandsForKey(Key key)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(KeyEventArgs e)
   at System.Windows.Controls.Control.OnKeyDown(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

Any ideas?

RadControls_for_Silverlight_4_2010_2_0812

Thank you.

5 Answers, 1 is accepted

Sort by
0
Rami Abughazaleh
Top achievements
Rank 1
answered on 27 Aug 2010, 10:44 PM
Ok, here are the steps to reproduce:
SL4 App MainPage.xaml:
<UserControl 
    x:Class="RadTreeListViewBug.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    mc:Ignorable="d"
    Height="800" Width="600">

    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadTreeListView 
                    x:Name="treeListView"
                    VerticalAlignment="Stretch"
                    HorizontalAlignment="Stretch"
                    AutoGenerateColumns="False"
                    IsReadOnly="True"
                    CanUserDeleteRows="False"
                    CanUserInsertRows="False"
                    RowIndicatorVisibility="Collapsed"
                    GridLinesVisibility="None"
                    AlternateRowBackground="#FAFAFA"
                    AlternationCount="2">
            <telerik:RadTreeListView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Hierarchy" MinWidth="150" />
            </telerik:RadTreeListView.Columns>
        </telerik:RadTreeListView>
    </Grid>
</UserControl>

MainPage.xaml.cs:
namespace RadTreeListViewBug
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            List<CustomViewModel> items = new List<CustomViewModel>();
            items.Add(new CustomViewModel() { Name = "Name" });
            treeListView.ItemsSource = items;
        }

    }

    public class CustomViewModel
    {
        public string Name { getset; }
    }
}


1. Run\Debug out of browser
2. After the single item in the treelistview is visible, press the right arrow
0
Veselin Vasilev
Telerik team
answered on 01 Sep 2010, 01:02 PM
Hello Rami Abughazaleh,

Please try with our latest official version - 2010.2.812.
I did not experience the problem there using the code you supplied.

Sincerely yours,
Veselin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rami Abughazaleh
Top achievements
Rank 1
answered on 01 Sep 2010, 07:17 PM
Hi Veselin,

I am using 2010.2.812.1040 and can still reproduce the bug.

Set a breakpoint in Application_UnhandledException and you will see the issue.

Windows 7 x64
Visual Studio 2010
Silverlight 4

It only happens when running the application out-of-browser.
0
Veselin Vasilev
Telerik team
answered on 06 Sep 2010, 03:02 PM
Hi Rami Abughazaleh,

I reproduced the problem now and will assign it to a developer for review.

I have updated your Telerik Points for your report.

Greetings,
Veselin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Accepted
Stefan Dobrev
Telerik team
answered on 07 Sep 2010, 02:01 PM
Hello Rami,

I'm writing to inform you that this bug has already been fixed in our codebase. It will be available in our next latest internal build expected this Friday. I have also logged this in our PITS web system (#3350) for your convenience.

Thanks again for your feedback. It is greatly appreciated.

Greetings,
Stefan Dobrev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeListView
Asked by
Rami Abughazaleh
Top achievements
Rank 1
Answers by
Rami Abughazaleh
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Stefan Dobrev
Telerik team
Share this question
or