RadGridView Fails To Load

3 posts, 0 answers
  1. Sam
    Sam avatar
    3 posts
    Member since:
    Nov 2011

    Posted 22 Nov 2011 Link to this post

    I'm having an issue with RadGridView causing flaky issues. Any help would be greatly appreciated.

    Varibles:
    RadWindow
    RadGridView
    MVVM
    Silverlight
    C#

    Issue:
    RadGridView appears to be not found. If I drag a RadGridView onto an existing or new UserControl it causes the designer to break in Expression Blend. However, in Visual Studios it gives an error that says

    "Unspecified error(Exeption from HRESULT:0x80004005 (E_FAIL))

    Now if I run my Silverlight application and click the button that brings in this particular RadWindow it fails on InitilizeComponent() saying:

    "Cannot find Type RadGridView"

    The InitilizeComponent code appears to be missing this element. See Below:

    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public void InitializeComponent() {
                if (_contentLoaded) {
                    return;
                }
                _contentLoaded = true;
                System.Windows.Application.LoadComponent(this, new System.Uri("/CloudNetTerritoryManager.Views;component/Views/RadWindowViews/TerritoryManagerAd" +
                            "justerBySupervisorRwView.xaml", System.UriKind.Relative));
                this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
                this.btnCounties = ((System.Windows.Controls.Button)(this.FindName("btnCounties")));
                this.btnSupervisor = ((System.Windows.Controls.Button)(this.FindName("btnSupervisor")));
                this.btnAdjusters = ((System.Windows.Controls.Button)(this.FindName("btnAdjusters")));
                this.lblIsValid = ((System.Windows.Controls.Label)(this.FindName("lblIsValid")));
                this.lblEffectiveDate = ((System.Windows.Controls.Label)(this.FindName("lblEffectiveDate")));
                this.dpEffectiveDate = ((System.Windows.Controls.DatePicker)(this.FindName("dpEffectiveDate")));
                this.recWarning = ((System.Windows.Shapes.Rectangle)(this.FindName("recWarning")));
                this.imgWarning = ((System.Windows.Controls.Image)(this.FindName("imgWarning")));
                this.lblWarning = ((System.Windows.Controls.Label)(this.FindName("lblWarning")));
                this.lblAddFieldSupervisor = ((System.Windows.Controls.Label)(this.FindName("lblAddFieldSupervisor")));
                this.btnCancel = ((System.Windows.Controls.Button)(this.FindName("btnCancel")));
                this.btnBack = ((System.Windows.Controls.Button)(this.FindName("btnBack")));
                this.btnSaveAndClose = ((System.Windows.Controls.Button)(this.FindName("btnSaveAndClose")));
            }

    Now I used intellisense to bring in the RadGridView. This caused it to show up in the Visual Studio Designer at one time, but still fails the same at run time. Also, if I open it in Expression Blend I get an Exception on Null Reference Root and it underlines the main <Telerik:RadWindow tag until I delete the Grid. Then the designer will show up. Also, I cannot drag a RadGridView in on Expression Blend either or the Designer breaks. I can type it in and it will show up in Visual Studios, but not Expression Blend.

    I have tried creating it through typing and dragging. Both on an existing RadWindow and a brand new UserControl. Same Error Either way.I have rebuilt a million times.

    Below is the XAML of the RadWindow that is failing:

    <!--Author
    //Name: Sam Rosewall
    //Team: CloudNet
    //LMB: Sam Rosewall
    //LMD: 11/16/2011
    -->
    <Telerik:RadWindow x:Class="CloudNetTerritoryManagerViews.TerritoryManagerAdjusterBySupervisorRwView"
        xmlns:Telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
        xmlns:sdk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
        xmlns:Converters="clr-namespace:CloudNetTerritoryManagerViews.Converters" mc:Ignorable="d"
        WindowStartupLocation="CenterScreen" ResizeMode="NoResize" CanClose="True"
        d:DesignHeight="800" d:DesignWidth="1000" Height="800" Width="1000" BorderThickness="0" Background="Transparent" BorderBackground="Transparent" BorderBrush="Transparent" xmlns:sdk1="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
        
         
        <!--Resource Dictionaries and Styles Sources-->
        <telerik:RadWindow.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="../../Resources/XAML.ResourceDictionary.xaml" />
                    <ResourceDictionary Source="../../Resources/XAML.RadWindow.Dictionary.xaml" />
                    <ResourceDictionary Source="../../Resources/XAML.DatePicker.xaml" />
                    <ResourceDictionary>
                        <Converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" TrueValue="Visible" FalseValue="Collapsed" />
                        <Converters:BoolToStyleConverter x:Key="BoolToStyleConverter" />
                        <Converters:BoolToUriConverter x:Key="BoolToUriConverter" />
                    </ResourceDictionary>                   
                </ResourceDictionary.MergedDictionaries>             
            </ResourceDictionary>
        </telerik:RadWindow.Resources>
        <telerik:RadWindow.Style>
            <StaticResource ResourceKey="RadWindowStyleHeader"/>
        </telerik:RadWindow.Style>
         
        <Grid x:Name="LayoutRoot" UseLayoutRounding="True" ShowGridLines="False" Background="White">
     
     
            <!--Wizard Navigation-->
            <Button x:Name="btnCounties" IsEnabled="{Binding AddFieldTerritoryCompleted}" Style="{StaticResource btnTransparent}" Click="btnCounties_Click"  Margin="12,8,852,725">
                <Button.Template>
                    <ControlTemplate TargetType='Button'>
                        <StackPanel>
                            <Rectangle x:Name="recCounties" Fill="{Binding AddFieldTerritoryCompleted, Converter={StaticResource BoolToStyleConverter}, ConverterParameter=Rectangle}"  Height="11" Width="128" Margin="0" />
                            <sdk:Label x:Name="lblCounties" Content="1 Counties" Foreground="{StaticResource LabelWizardInActiveBrush}" Width="100" FontSize="13.333" HorizontalAlignment="Left"  Margin="0" />
                        </StackPanel>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button x:Name="btnSupervisor" IsEnabled="{Binding AddFieldSupervisorCompleted}" Style="{StaticResource btnTransparent}" Click="btnSupervisor_Click"  Margin="180,8,684,725">
                <Button.Template>
                    <ControlTemplate TargetType='Button'>
                        <StackPanel>
                            <Rectangle x:Name="recGreen" Fill="{Binding AddFieldSupervisorCompleted, Converter={StaticResource BoolToStyleConverter}, ConverterParameter=Rectangle}" HorizontalAlignment="Left" Height="11" Margin="0" VerticalAlignment="Top" Width="128"/>
                            <sdk:Label x:Name="lblSupervisor" Content="2 Supervisor" Foreground="{StaticResource LabelWizardInActiveBrush}" HorizontalAlignment="Left" Height="19" Margin="0" VerticalAlignment="Top" Width="128" FontSize="13.333" />
                        </StackPanel>
                    </ControlTemplate>
                </Button.Template>
            </Button>
            <Button x:Name="btnAdjusters" IsEnabled="{Binding AdjustersBySupervisorCompleted}" Style="{StaticResource btnTransparent}" Click="btnAdjusters_Click"  Margin="348,8,516,725">
                <Button.Template>
                    <ControlTemplate TargetType='Button'>
                        <StackPanel>
                            <Rectangle x:Name="recGray" Fill="{StaticResource RectangleWizardActiveBrush}" HorizontalAlignment="Left" Height="11" Margin="0" VerticalAlignment="Top" Width="128"/>
                            <sdk:Label x:Name="lblAdjusters" Content="3 Adjusters" Foreground="{StaticResource LabelWizardActiveBrush}" HorizontalAlignment="Left" Height="19" Margin="0" VerticalAlignment="Top" Width="128" FontSize="13.333" />
                        </StackPanel>
                    </ControlTemplate>
                </Button.Template>
            </Button>
        
     
            <!--Effective Date-->
            <sdk1:Label Height="28" HorizontalAlignment="Left" Margin="775,68,0,0" Name="lblEffectiveDate" Content="Effective Date:" VerticalAlignment="Top" FontSize="12" Width="89" />
            <sdk1:DatePicker HorizontalAlignment="Left" Background="{Binding IsWarningVisible, Converter={StaticResource BoolToStyleConverter}, ConverterParameter=WarningControl}"  Name="dpEffectiveDate" SelectedDate="{Binding EffectiveDate, Mode=TwoWay}" VerticalAlignment="Top" Style="{StaticResource DatePickerStyle1}" Margin="870,65,0,0" Width="109" />
     
     
            <!--Warning-->
            <Rectangle x:Name="recWarning" Fill="{StaticResource WarningPinkBrush}" Visibility="{Binding IsWarningVisible, Converter={StaticResource BoolToVisibilityConverter}}" Canvas.ZIndex="95" Height="35" Width="434" Margin="547,12,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Image x:Name="imgWarning" Source="{Binding AddFieldTerritoryCompleted, Converter={StaticResource BoolToUriConverter}, ConverterParameter=imgWarning}" Visibility="{Binding IsWarningVisible, Converter={StaticResource BoolToVisibilityConverter}}" Canvas.ZIndex="96" Height="28" Width="28" Margin="552,15,0,0" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Top" />
            <sdk:Label x:Name="lblWarning" Content="{Binding ErrorMessage}" Visibility="{Binding IsWarningVisible, Converter={StaticResource BoolToVisibilityConverter}}" Canvas.ZIndex="97" Height="23" Margin="586,20,20,0" FontSize="12" VerticalAlignment="Top"  />
     
     
            <!--Adjusters Grid-->
            <sdk:Label x:Name="lblAddFieldSupervisor" Content="Add Field Territory - Adjusters" Style="{StaticResource H1}" HorizontalAlignment="Left" Height="25" Margin="18,71,0,0" VerticalAlignment="Top" Width="425" />
            <telerik:RadGridView Margin="0,102,0,0">
            </telerik:RadGridView>
             
     
            <!--Buttons-->
            <Button x:Name="btnCancel" Style="{StaticResource btnCancel}" Margin="675,688,247,55" Click="btnCancel_Click" />
            <Button x:Name="btnBack" Style="{StaticResource btnBack}" Margin="753,689,169,54" Click="btnBack_Click" />
            <Button x:Name="btnSaveAndClose" Style="{StaticResource btnSaveAndClose}" Margin="830,688,30,55" Click="btnSaveAndClose_Click" />
     
     
        </Grid>
    </Telerik:RadWindow>


    I'm not sure why this refuses to build or show up in Expression Blend, but I can tell you that my ToolBox Telerik is most likely outdated because I updated from Q1 2010 old version to Q3 2011 newest version a week ago and ran the Update Wizard for Telerik. I have updated all reference to point to the correct version and accounted for the namespace change of Telerik.Windows.Controls to Telerik.Windows.Controls.GridView. This project is completely MVVM and I have put the references for Controls and Controls.GridView in both the Views Project and the Main Client Project that creates the XAP file. I have other Telerik References as well, but these are the relevent ones for this discussion. I am using 2011.3.1116.1040 for my dll versions.

    Any help would be greatly appreciated in pointing me to the correct answer to this problem.

    Thanks,

    Sam
  2. Sam
    Sam avatar
    3 posts
    Member since:
    Nov 2011

    Posted 22 Nov 2011 Link to this post

    Man this happens to me everytime!

    I get impatient after a couple of hours worth of failure and then an hour later I figure it out. To experiment further I removed the RadGridView from the XAML and built it in C#. This caused an entirely different new error. It was complaining that it couldn't find Telerik.Windows.Data version 2011.3.1116.1040

    I double checked my VIews project and the reference was there and correct. Then I double checked my Main Silverlight Project that compiles the Xap file and found this particular reference was missing. I thought I had all references in both spots. It seems silly that I would need it in the parent project when it is in the views project already, but it probably has to do with drawing the UserControls into the UserControlContainer in my main project.

    Anyways, I added the reference and I'm cooking right along.

    Thanks anyways, and hopefully this saves someone else a headache.

    Sam
  3. Sam
    Sam avatar
    3 posts
    Member since:
    Nov 2011

    Posted 22 Nov 2011 Link to this post

    I'm not really sure how to mark this as Answered.

    Anyone?
Back to Top