Bug Report (2010_Q3) null reference

8 posts, 0 answers
  1. Alex Fan
    Alex Fan avatar
    39 posts
    Member since:
    Jul 2009

    Posted 12 Jan 2011 Link to this post

    Hi

    please try this, 

    <UserControl
        x:Class="TestSilverlightApplication.MainPage1"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
        xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" xmlns:TestSilverlightApplication="clr-namespace:TestSilverlightApplication" mc:Ignorable="d" d:DesignHeight="435" d:DesignWidth="613">
        <UserControl.Resources>
            <TestSilverlightApplication:MainViewModel x:Key="MainViewModel"/>
             
            <Controls:ContainerBindingCollection x:Key="ContainerBindingCollection">
                <Controls:ContainerBinding PropertyName="TileState"
                       Binding="{Binding TileState, Mode=TwoWay}" />
            </Controls:ContainerBindingCollection>
            <DataTemplate x:Key="ItemTemplate" Controls:ContainerBinding.ContainerBindings="{StaticResource ContainerBindingCollection}">
                <TextBlock Text="{Binding Path=Header}"/>
            </DataTemplate>
        </UserControl.Resources>
     
        <Grid x:Name="LayoutRoot" Background="White" DataContext="{StaticResource MainViewModel}">
            <telerik:RadTileView ItemsSource="{Binding Path=TileViewModels}" ItemTemplate="{StaticResource ItemTemplate}"/>
        </Grid>
    </UserControl>


    c#
    using System.Collections.Generic;
    using System.Windows.Controls;
     
    namespace TestSilverlightApplication
    {
        using Telerik.Windows.Controls;
        using ViewModelBase = GalaSoft.MvvmLight.ViewModelBase;
     
        public partial class MainPage1 : UserControl
        {
            public MainPage1()
            {
                InitializeComponent();
            }
        }
     
        public class MainViewModel :ViewModelBase
        {
            public MainViewModel()
            {
                TileViewModels = new List<TileViewModel>
                                  {
                                      new TileViewModel() { Header = "h1", SmallContent = "small1", Content = "normal1", LargeContent = "large1", TileState = TileViewItemState.Maximized},
                                      new TileViewModel() { Header = "h2", SmallContent = "small2", Content = "normal2", LargeContent = "large2"},
                                  };
            }
     
            public List<TileViewModel> TileViewModels { get; set; }
        }
     
        public class TileViewModel : ViewModelBase
        {
            public string Header { get; set; }
            public string SmallContent { get; set; }
            public string Content { get; set; }
            public string LargeContent { get; set; }
            public TileViewItemState TileState { get; set; }
        }
    }

    if you run it, u get null reference exception. the reason i guess is, when the first TileViewItem is created, it is trying to bind to TileState which is set to Max. This will trigger this first tile to maximize itself and also it will try to minimize second tile which have not been created yet.

    Regards,
    Alex
  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 12 Jan 2011 Link to this post

    Hi Alex Fan,

     Thank you for this bug report. I looked into it and really the problem is that when the first item's TileState is set to Maximized it tries to access the container of the second item which is still not generated.
    I've updated your Telerik account and if you have further questions feel free to ask.

    Regards,
    Zarko
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Alex Fan
    Alex Fan avatar
    39 posts
    Member since:
    Jul 2009

    Posted 12 Jan 2011 Link to this post

    Hi

    Can I know when this will be fixed :) or maybe a work around will be good as well. Because I don't want to hardcode xaml for each tile and later on I will have to come back and refactor the code....

    thanks

    Regards
    Alex Fan
  5. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 13 Jan 2011 Link to this post

    Hi Alex Fan,

     Currently we're making a major refactoring on the TileView which will be ready for the Q1 2011 Beta and this bug will be fixed with that release.
    For now the easiest work around is to handle the Loaded event of the TileView and set the MaximizedItem in it like that:

    private void myTileView_Loaded(object sender, RoutedEventArgs e)
    {
        this.myTileView.MaximizedItem = this.myTileView.Items[0];
    }
    If you have more questions don't hesitate to ask.

    Kind regards,
    Zarko
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  6. Alex Fan
    Alex Fan avatar
    39 posts
    Member since:
    Jul 2009

    Posted 22 Feb 2011 Link to this post

    Hi

    We have upgraded our Telerik control to Q3 2010 sp1. Now we can bind the TileState property, but when you try to maximize any tile, it will quickly maximize itself, minimize all the rest tiles then all tiles will be set back to restored, which means you cannot maximize a tile once you have TileState property twoway bound to viewmodel.

    Regards,
    Alex
  7. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 25 Feb 2011 Link to this post

    Hi Alex Fan,

     Unfortunately I wasn't able to reproduce your problem so could you please send us some more information (a project that reproduces the issue or some code snippets). Note that the Q1 2011 Beta is out now and there are major changes to the RadTIleView (including fix for the initial bug you reported) so you can try it out.

    Best wishes,
    Zarko
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  8. Alex Fan
    Alex Fan avatar
    39 posts
    Member since:
    Jul 2009

    Posted 27 Feb 2011 Link to this post

    Hi

    Actually when i re-run my little test solution with Q3 version dlls, i find that this problem is not fixed in Q3. I still get the same exception. Did you test the same code that I posted before?

    Regards
    Alex
  9. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 28 Feb 2011 Link to this post

    Hi Alex Fan,

     Yes your initial problem is not fixed in the Q3 release, but it is fixed in the Q1 Beta that we released last week. In the last three months the RadTileView was literally rewritten and I'll advise you to start using the new one because all known bugs are fixed in it and it has a couple of very nice new features.
    If you need further assistance feel free to ask.

    All the best,
    Zarko
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top
DevCraft banner