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

NullReferenceException in GridViewRow.OnIsExpandedChanged

1 Answer 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 29 Apr 2011, 07:26 AM
Hello!
Found one problem with radgridviev, which I dont know how to fix.

My scenario:

WPF app for .NET Framework 4
Windows 7 (x64) Ultimate
Version of Telerik dll's: 2011.1.419.40

Here's a structure of document that i'm querying from data source:
Client 
-- Animals
----- Receptions 
(there's other relations like Client - Contacts and so on...)

I show the data to user using the following hierarchy:

RadGridView (showing clients)
-- TabControl
----- RadGridView (showing animals)
---------- TabControl
--------------- RadGridView (showing receptions)


Now, for the problem:

Every RadGridView in hierarchy has handlers for: SelectionChanged, Deleted, RowEditEnded. 
When i add any of SelectionChanged, Deleted, RowEditEnded handler to receptions RadGridView my app shows only the clients grid (the topmost one) with "+" that's not expandable.
Without handlers everything (in leaf RadGridView) works as expected.
If i use a debugger it shows that i have exception: NullReferenceException that's throwed from GridViewRow.OnIsExpandedChanged.

Here's a part of xaml i use :
http://pastebin.com/84hQ9rAP

Any suggestions about what am i doing wrong?

EDIT: 

if i delete "RowStyleSelector="{StaticResource ReceptionRowStyleSelector}" and add handlers to my nested grid - then all seems to work again an there's no exception. But i have no row styling for grid.

That's my ReceptionRowStyleSelector code:

public class ReceptionRowStyleSelector : StyleSelector<br>  
{
  
public override Style SelectStyle(object item, DependencyObject container)
  {            
if (item is Reception)   
{  
            var reception = (Reception)item;
            if (reception.IsCompleted) return CompletedReception;
            
if (reception.IsCanceledByClient) return CanceledReception;
    
if (reception.IsClientNotified) return NotifiedReception;
 }
return DefaultStyle;
 }

...

Styles i use a very simple:

<local:ReceptionRowStyleSelector x:Key="ReceptionRowStyleSelector">
            <local:ReceptionRowStyleSelector.DefaultStyle>
                <Style TargetType="telerik:GridViewRow"></Style>
            </local:ReceptionRowStyleSelector.DefaultStyle>
            <local:ReceptionRowStyleSelector.CompletedReception>
                <Style TargetType="telerik:GridViewRow">
                    <Setter Property="Background" Value="#4502FF49"/>
                </Style>
            </local:ReceptionRowStyleSelector.CompletedReception>
            <local:ReceptionRowStyleSelector.CanceledReception>
                <Style TargetType="telerik:GridViewRow">
                    <Setter Property="Background" Value="#40000000"/>                
                </Style>
            </local:ReceptionRowStyleSelector.CanceledReception>
            <local:ReceptionRowStyleSelector.NotifiedReception>
                <Style TargetType="telerik:GridViewRow">
                    <Setter Property="Background" Value="#4FA4B700"/>
                </Style>
            </local:ReceptionRowStyleSelector.NotifiedReception>
        </local:ReceptionRowStyleSelector>

Thanks, Alex Yakimaskiy

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 29 Apr 2011, 12:06 PM
Hello Alex,

 Please get our latest internal build. We believe that we've already fixed this. 

All the best,
Vlad
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
GridView
Asked by
Alex
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or