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

Expression Blend NullReferenceException

4 Answers 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris Carter
Top achievements
Rank 1
Chris Carter asked on 25 Mar 2009, 04:07 PM
We have a WPF project which uses several telerik grids.  We bind to the grids by using setting the DataContext property in the Window_Loaded, and the ItemsSource on each grid to "{Binding}".  Using the Q308 release, the grids worked in Blend and Visual Studio (though had a whole host of other issues which I won't get into).  Now that Q109 is out, I have upgrade all of our references to the new DLLs, but not changed any code.  The project will build just fine, and the application will work (other than an issue that I will submit in another post).

However, with the new DLLS, the Visual Studio designer will crash as soon as I open the XAML (with no error), and Expression Blend refuses to open the XAML - it displays a NullReferenceException, which appears to being thrown in the Telerik.Windows.Controls.GridView.GridViewITemsControl.DisconnectFromDataEventsFunction().  I would paste the entire contents of the exception, but the developers of Blend apparently saw fit to not include the ability to copy the text of errors that occur in the application.

Any ideas, or do you need more information?

4 Answers, 1 is accepted

Sort by
0
Chris Carter
Top achievements
Rank 1
answered on 25 Mar 2009, 05:06 PM
This hotfix has resolved the crashing Visual Studio issue, which appears to be a problem with Visual Studio rather than the Telerik dlls:


Expression Blend, however, is still unable to open the XAML page after updating with the latest Telerik version.
0
Hristo Deshev
Telerik team
answered on 27 Mar 2009, 05:04 PM
Hello Chris Carter,

Thanks for posting the resolution to the VS crash problem. Can you provide some detail on reproducing the Blend-related NullReferenceException too? I tried to reproduce it, but the control displays fine on my end (see the attached screenshot).

Maybe it would be best if you post your entire page along with its code-behind file.

Kind regards,
Hristo Deshev
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Nate
Top achievements
Rank 1
answered on 23 Apr 2009, 05:43 PM
Our developer was having the same problem and it was driving us both nuts. Still is...  Anyway, I will attach a project that shows the problem. In my project I am using the RadTabControl as well as RadGridView. When the SelectedIndex (XAML) is on the tab without any grid, we get the NullReferenceException in Blend 2 SP1. If I change the SelectedIndex (to 1 in my example) to be the page that has the grid then it renders fine in Blend SP1. The problem we are having is we have a Window with 8 TabControls, so there is no possible way to be on the One that has the grid, as 6 of them have grids. I am attaching a sample project that will show you exactly what is going on. All you have to do is change the selectedindex in the xaml to the other page, and then open the project in blend and you will see the problem...

Thanks for your help!!!
Nate


Here is my XAML File that you can use to easily reproduce this problem....
<Window x:Class="AllianceWPF.PersonWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="PersonWindow"  Height="388" Width="631" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">  
    <telerik:RadTabControl SelectedIndex="0">  
        <telerik:RadTabItem Width="50" Header="Person" Name="Person">  
            <Grid> 
                <ComboBox SelectedValue="{Binding Path=PersonTypeId,Mode=TwoWay}" Height="23" Margin="0,19,129,0" Name="PersonTypeId" VerticalAlignment="Top" HorizontalAlignment="Right" Width="120" /> 
                <Label Height="23" Margin="273,19,263,0" Name="label1" VerticalAlignment="Top" Padding="3">PersonType</Label> 
                <TextBox Text="{Binding Path=FirstName,Mode=TwoWay}" Height="23" Margin="100,19,0,0" Name="Firstname" VerticalAlignment="Top" HorizontalAlignment="Left" Width="158" /> 
                <Label Height="23" HorizontalAlignment="Left" Margin="21,19,0,0" Name="label2" Padding="3" VerticalAlignment="Top" Width="73" HorizontalContentAlignment="Right">First Name</Label> 
                <TextBox Text="{Binding Path=LastName,Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="100,48,0,0" Name="Lastname" VerticalAlignment="Top" Width="158" /> 
                <Label Height="23" HorizontalAlignment="Left" Margin="21,48,0,0" Name="label3" Padding="3" VerticalAlignment="Top" Width="73" HorizontalContentAlignment="Right">Last Name</Label> 
                <TextBox Text="{Binding Path=Department,Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="100,109,0,0" Name="Department" VerticalAlignment="Top" Width="158" /> 
                <Label Height="23" HorizontalAlignment="Left" Margin="21,109,0,0" Name="label4" Padding="3" VerticalAlignment="Top" Width="73" HorizontalContentAlignment="Right">Department</Label> 
                <TextBox Text="{Binding Path=Email,Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="100,138,0,0" Name="email" VerticalAlignment="Top" Width="158" /> 
                <Label Height="23" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="21,138,0,0" Name="label5" Padding="3" VerticalAlignment="Top" Width="73">E-Mail</Label> 
                <TextBox Text="{Binding Path=WorkPhone,Mode=TwoWay}" HorizontalAlignment="Left" Margin="100,167,0,160" Name="workphone" Width="158" /> 
                <Label HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="12,167,0,160" Name="label6" Padding="3" Width="82">Work Phone</Label> 
                <TextBox Text="{Binding Path=CellPhone,Mode=TwoWay}" HorizontalAlignment="Left" Margin="100,0,0,131" Name="cellphone" Width="158" Height="23" VerticalAlignment="Bottom" /> 
                <Label HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="12,0,0,131" Name="label7" Padding="3" Width="82" Height="23" VerticalAlignment="Bottom">Cell Phone</Label> 
                <TextBox Text="{Binding Path=Fax,Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="100,0,0,102" Name="fax" VerticalAlignment="Bottom" Width="158" /> 
                <Label Height="23" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="12,0,0,102" Name="label8" Padding="3" VerticalAlignment="Bottom" Width="82">Fax</Label> 
                <TextBox Text="{Binding Path=Title,Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="100,79,0,0" Name="Title" VerticalAlignment="Top" Width="158" /> 
                <Label Height="23" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="21,79,0,0" Name="label9" Padding="3" VerticalAlignment="Top" Width="73">Title</Label> 
                <Button Height="23" HorizontalAlignment="Right" Margin="0,0,21,20" Name="savebutton" VerticalAlignment="Bottom" Width="75">Save</Button> 
                <Label Height="22.134" HorizontalAlignment="Right" HorizontalContentAlignment="Center" Margin="0,13,12,0" VerticalAlignment="Top" VerticalContentAlignment="Top" Width="43">ID</Label> 
                <TextBox Text="{Binding Path=PersonId,Mode=TwoWay}" Background="{x:Null}" Cursor="No" Focusable="False" Height="22.98" HorizontalAlignment="Right" HorizontalContentAlignment="Center" Margin="0,33,12,0" Name="PersonID_TextBlock" Padding="1" TextDecorations="None" VerticalAlignment="Top" Width="43" /> 
                <ComboBox SelectedValue="{Binding Path=MedicalEntityId,Mode=TwoWay}" Height="23" HorizontalAlignment="Right" Margin="0,48,129,0" Name="MedicalEntityId" VerticalAlignment="Top" Width="120" IsEnabled="False" /> 
                <Label Height="23" Margin="264,48,255,0" Name="label10" Padding="3" VerticalAlignment="Top">Medical Entity</Label> 
                <CheckBox IsChecked="{Binding Path=Inactive,Mode=TwoWay}" Height="16" HorizontalAlignment="Right" Margin="0,86,96,0" Name="Inactive" VerticalAlignment="Top" Width="76">Inactive</CheckBox> 
            </Grid> 
        </telerik:RadTabItem> 
        <telerik:RadTabItem Width="100" Header="Person Data" Name="PersonData">  
            <Grid Height="325">  
                <telerik:RadGridView Margin="1,55,-1,6" ShowColumnHeaders="True" ShowGroupPanel="False">  
 
                </telerik:RadGridView> 
                <Button Height="23" Margin="0,5,6,0" Name="button1" VerticalAlignment="Top" HorizontalAlignment="Right" Width="62">_Save</Button> 
                <ComboBox SelectedValue="{Binding Path=PersonDataFieldId,Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="6,26,0,0" Name="persondatafields" VerticalAlignment="Top" Width="120" /> 
                <TextBox Text="{Binding Path=PersonData,Mode=TwoWay}" Height="43" Margin="305,6,0,0" Name="textBox1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="174" /> 
                <Label Height="28" Margin="253,4,0,0" Name="label11" VerticalAlignment="Top" HorizontalAlignment="Left" Width="46">Data</Label> 
                <Label Height="28" HorizontalAlignment="Left" Margin="6,0,0,0" Name="label12" VerticalAlignment="Top" Width="56">DataFields</Label> 
                <Label Height="24" Margin="132,4,0,0" Name="label13" VerticalAlignment="Top" HorizontalAlignment="Left" Width="68">Date</Label> 
                <Label Height="23" HorizontalAlignment="Right" Margin="0,4,96,0" Name="label14" VerticalAlignment="Top" Width="26">ID</Label> 
                <TextBlock Height="21" HorizontalAlignment="Right" Margin="0,28,75,0" Name="PersonDataId" VerticalAlignment="Top" Width="47" /> 
            </Grid> 
        </telerik:RadTabItem> 
    </telerik:RadTabControl> 
</Window> 
0
Nate
Top achievements
Rank 1
answered on 27 Apr 2009, 05:21 PM
Telerik has fix this bug with their very latest nightly code.

Nate
Tags
GridView
Asked by
Chris Carter
Top achievements
Rank 1
Answers by
Chris Carter
Top achievements
Rank 1
Hristo Deshev
Telerik team
Nate
Top achievements
Rank 1
Share this question
or