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

Grid causes silverlight application to quit

5 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 18 Dec 2008, 11:23 PM
Hi,
I've been trying to get the grid working, but every time I add the grid control to my Xaml, it breaks my application.  When debugging, it goes in the application startup method, then right after that, it goes to the application_exit method.  I can only assume it's because it doesn't like somthing with the grid.
 
private void Application_Startup(object sender, StartupEventArgs e)
        {
            this.RootVisual = new Page();
        }

        private void Application_Exit(object sender, EventArgs e)
        {

        }


here's my xaml.


<UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  
             xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"  
             xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"  
             x:Class="WTXNetSilver2.Page"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:core="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
             xmlns:WTXNetSilver2="clr-namespace:WTXNetSilver2"
             xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
             xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
             Width="800" Height="600">



    <UserControl.Resources>
        <WTXNetSilver2:TreeArea x:Key="TreeAreaDS" />

        <core:HierarchicalDataTemplate x:Key="battery" ItemsSource="{Binding well}" >
            <TextBlock Text="{Binding Name}" Foreground="Green" FontStyle="Italic" />
        </core:HierarchicalDataTemplate>

        <core:HierarchicalDataTemplate x:Key="area" ItemsSource="{Binding battery}"
                ItemTemplate="{StaticResource battery}">
            <TextBlock Text="{Binding Name}" Foreground="Green" FontStyle="Italic" />
        </core:HierarchicalDataTemplate>

    </UserControl.Resources>




    <Grid x:Name="LayoutRoot" Background="White" ShowGridLines="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="30"></ColumnDefinition>
            <ColumnDefinition Width="200"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
            <ColumnDefinition Width="30"></ColumnDefinition>
        </Grid.ColumnDefinitions>




       



        <telerikInput:RadComboBox x:Name="comboBoxCompany" Grid.Row="1" Grid.Column="1"></telerikInput:RadComboBox>

        <telerikNavigation:RadTreeViewItem x:Name="treeItem"></telerikNavigation:RadTreeViewItem>


        <telerikNavigation:RadTreeView x:Name="treeWells" Width="555" Height="555" HorizontalAlignment="Left"
                VerticalAlignment="Top"
                IsTriStateMode="True" IsLineEnabled="True"
                IsOptionElementsEnabled="True" ItemsOptionListType="CheckList"

                                         
                 ItemsSource="{Binding Source={StaticResource TreeAreaDS}}"
                ItemTemplate="{StaticResource area}"
                      Grid.Row="2" Grid.Column="1"/>

    </Grid>
</UserControl>

I'm completely lost, and I suppose it is forgivable due to the beta stage of the gird, however, I've had enough troubles getting other RadSilverLight controls to work, that I'm about the throw in the towel for your Silverlight product.... Not enough documentation is killing this product, I know you've heard it before, but it's rediculous that I have to surf Google for hours on end to find solutions to your tools.

Chad

5 Answers, 1 is accepted

Sort by
0
Chad
Top achievements
Rank 1
answered on 18 Dec 2008, 11:41 PM
oops, sorry for the double post.

I've been looking through the Grid examples.  I'm just wondering, Do I need to bind the grid to some data right when the page loads?  At the moment, the grid is populated by checking a checkbox. 

I've tried to bind it to null, but that didn't work.

Chad
0
Serrin
Top achievements
Rank 1
answered on 19 Dec 2008, 06:47 PM
Hey Chad,

I haven't checked out the brand spanking new release, but I know as of the release that came in Q3 you have to bind it do at least an empty class or it will crash.  I am hoping the newest release fixes this, but otherwise that solves the crash problem.
0
Chad
Top achievements
Rank 1
answered on 19 Dec 2008, 08:11 PM
Thank you, it works fine now.

For anyone else that may have this problem:

1) create a class to hold your grid data:

public class data
{
  public string data1 {get; set;}
 public string data2 {get; set}
}


2) create a List of the class, and bind it.

public void method()
{
 new List<data> gridList = new List<data>(); // make the list
 
grid.ItemSource = gridList;  // bind the list to the grid.  Everything should work fine after this.

}
0
Chad
Top achievements
Rank 1
answered on 19 Dec 2008, 08:24 PM
you must bind the grid on the startup method.  The default name for the startup method is "public Page()", so bind the data in that method, otherwise it will break.
0
Nikolay
Telerik team
answered on 20 Dec 2008, 08:16 AM
Hello Chad,

We are sorry to hear that you experience problems with our controls.

We have a known issue with the CTP edition of our RadGridView. When you show a grid that has not been bound to any data at that time, an exception will appear. This bug has already been fixed with the latest SP2 release, which you can download from your account.

Also, you can work the issue around by binding the RadGridView control to an empty list. For example:
this.testGrid.ItemsSource = new List<string>();    

As for the documentation glithces - we are continuously working on the matter. With the latest SP2 release we have added a full documentation for the RadNavigation control. We will be improving the rest of the topics so that the help becomes more consistent and helpful. We apologize for the inconvenience this lack of documentation causes you. You can always write to us when a certain problem appears to be a show-stopper for your development and you cannot find enough details within the support resources (docs, kb articles, etc.).

Best wishes,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Chad
Top achievements
Rank 1
Answers by
Chad
Top achievements
Rank 1
Serrin
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or