Error 4004 Unhandled Error in Silverlight Application

4 posts, 1 answers
  1. vinay Theethira
    vinay Theethira avatar
    35 posts
    Member since:
    Mar 2010

    Posted 25 Apr 2011 Link to this post

    Hi,

    I am using TileView Control from Telerik Rad control, when i run the application i can view the tileview but when i try to maximize any of the panel then i get a Error Message stating,

    An unhandled exception ('Unhandled Error in Silverlight Application
    Code: 4004
    Category: ManagedRunTimError
    Message: System.InvalidOperationException:Unable to Maximize an item with current configuration.
    at Telerik.Windows.Controls.TileViewPanel.GetMaximizedItemSize()
    at
    Telerik.Windows.Controls.TileViewPanel.MeasureNonRestoredChildren()
    at Telerik.Windows.Controls.TileViewPanel.MeasureOverride(size availablesize)
    at System.Windows.FrameworkElement.MeasureOverride(

    An unhandled exception ('Unhandled Error in Silverlight Application

    Code: 4004

    Category: ManagedRunTimError

    Message: System.InvalidOperationException:Unable to Maximize an item with current configuration.

    at Telerik.Windows.Controls.TileViewPanel.GetMaximizedItemSize()

    at

    Telerik.Windows.Controls.TileViewPanel.MeasureNonRestoredChildren()

    at Telerik.Windows.Controls.TileViewPanel.MeasureOverride(size availablesize)

    at System.Windows.FrameworkElement.MeasureOverride(

    Here is my XAML File........

    <UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="IATRICTestProject.Views.TileView1"
        xmlns:tileview="clr-namespace:Telerik.Windows.Controls.TileView;assembly=Telerik.Windows.Controls.Navigation"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
     
        <UserControl.Resources>
     
            <DataTemplate x:Key="CustomerHeaderTemplate">
                <TextBlock Text="{Binding FirstName}" />
            </DataTemplate>
     
            <tileview:TileToFluideStateConverter x:Key="tileConverter" />
     
            <Style TargetType="TextBlock" x:Key="TextStyle">
                <Setter Property="FontSize" Value="12" />
                <Setter Property="FontFamily" Value="Verdana" />
            </Style>
     
            <Style TargetType="TextBlock" x:Key="TitleTextStyle" BasedOn="{StaticResource TextStyle}">
                <Setter Property="FontWeight" Value="Bold" />
            </Style>
     
            <DataTemplate x:Key="CustomerTemplate">
                <telerik:RadFluidContentControl ContentChangeMode="Manual" TransitionDuration="0:0:.5" SmallToNormalThreshold="400 400" NormalToSmallThreshold="400 400"
       NormalToLargeThreshold="600 600" LargeToNormalThreshold="600 600"
                                            State="{Binding State, Converter={StaticResource tileConverter}}">
                     
                    <telerik:RadFluidContentControl.SmallContent>
                        <StackPanel Orientation="Horizontal" Margin="10">
                            <TextBlock Text="First Name:" />
                            <TextBlock Text="{Binding FirstName}"  />
                        </StackPanel>
                    </telerik:RadFluidContentControl.SmallContent>
                     
                    <telerik:RadFluidContentControl.Content>
                        <telerik:RadWrapPanel Margin="20">
                            <StackPanel Orientation="Horizontal" Margin="10">
                                <TextBlock Text="First Name:" />
                                <TextBlock Text="{Binding FirstName}"  />
                            </StackPanel>                       
                            <StackPanel Orientation="Horizontal" Margin="10">
                                <TextBlock Text="Company Name:" />
                                <TextBlock Text="{Binding CompanyName}"  />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Margin="10">
                                <TextBlock Text="Email ID:" />
                                <TextBlock Text="{Binding EmailAddress}"  />
                            </StackPanel>                       
                        </telerik:RadWrapPanel>
                    </telerik:RadFluidContentControl.Content>
                     
                    <telerik:RadFluidContentControl.LargeContent>
                        <Grid Width="600" Height="600">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
     
                            <!--<Image Source="../Images/TileView/Flags/map.png" Grid.ColumnSpan="2" Grid.RowSpan="2" />
                            <Image Source="{Binding LargeFlag}" Grid.Column="1" Margin="10" />-->
                            <telerik:RadWrapPanel Margin="20">
                                <StackPanel Orientation="Horizontal" Margin="10">
                                    <TextBlock Text="First Name:" />
                                    <TextBlock Text="{Binding FirstName}"  />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Margin="10">
                                    <TextBlock Text="Last Name:" />
                                    <TextBlock Text="{Binding LastName}"  />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Margin="10">
                                    <TextBlock Text="Company Name:" />
                                    <TextBlock Text="{Binding CompanyName}"  />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Margin="10">
                                    <TextBlock Text="Email ID:" />
                                    <TextBlock Text="{Binding EmailAddress}"  />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Margin="10">
                                    <TextBlock Text="Phone:" />
                                    <TextBlock Text="{Binding Phone}"  />
                                </StackPanel>
                            </telerik:RadWrapPanel>
                            <TextBlock FontSize="11" TextWrapping="Wrap" Text="{Binding EmailAddress}" Grid.Row="1"
                                                                    Grid.ColumnSpan="2" Margin="20" />
                        </Grid>
                    </telerik:RadFluidContentControl.LargeContent>
                </telerik:RadFluidContentControl>
            </DataTemplate>
     
            <Style TargetType="telerik:RadTileView">
                <Setter Property="PreservePositionWhenMaximized" Value="True" />
                <Setter Property="telerik:TileViewPanel.IsVirtualized" Value="True" />
                <Setter Property="IsAutoScrollingEnabled" Value="True" />
                <Setter Property="TileStateChangeTrigger" Value="SingleClick" />
                <Setter Property="MinimizedColumnWidth" Value="180" />
                <Setter Property="MinimizedRowHeight" Value="155" />
                <Setter Property="RowHeight" Value="155" />
                <Setter Property="ColumnWidth" Value="180" />
                <Setter Property="ColumnsCount" Value="5" />
                <Setter Property="ContentTemplate" Value="{StaticResource CustomerTemplate}" />
                <Setter Property="ItemTemplate" Value="{StaticResource CustomerHeaderTemplate}" />
            </Style>
        </UserControl.Resources>
     
        <Border CornerRadius="6" >
            <telerik:RadTileView x:Name="radTileView" TileStateChanged="tileView1_TileStateChanged"
                                    TileStateChangeTrigger="SingleClick"                           
                                    IsItemDraggingEnabled="True"
                                    PreservePositionWhenMaximized="True">
            </telerik:RadTileView>
        </Border>
    </UserControl>

    And here is my XAML.CS file
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using IATRICTestProject.Web;
    using Telerik.Windows.Controls;
     
    namespace IATRICTestProject.Views
    {
        public partial class TileView1 : UserControl
        {
            public TileView1()
            {
                InitializeComponent();
                Loaded += new RoutedEventHandler(TileView1_Loaded);
            }
     
            void TileView1_Loaded(object sender, RoutedEventArgs e)
            {
                try
                {
                    AdventureWorksDomainContext ctx = new AdventureWorksDomainContext();               
                    this.radTileView.ItemsSource = ctx.Customers;                        
                    ctx.Load(ctx.GetCustomerQuery());
                }
                catch (Exception ex)
                {
                }
            }
     
            private void RadTileView_TileStateChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
     
            }
     
            private void tileView1_TileStateChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                try
                {
                    e.Handled = true;
                    RadTileViewItem item = e.OriginalSource as RadTileViewItem;
                    if (item != null)
                    {
                        var fluidControls = item.ChildrenOfType<RadFluidContentControl>();
                        if (fluidControls.Count == 0)
                        {
                            return;
                        }
                        RadFluidContentControl fluidControl = fluidControls[0];
     
                        switch (item.TileState)
                        {
                            case TileViewItemState.Maximized:
                                fluidControl.State = FluidContentControlState.Large;
                                break;
                            case TileViewItemState.Minimized:
                                fluidControl.State = FluidContentControlState.Small;
                                break;
                            case TileViewItemState.Restored:
                                fluidControl.State = FluidContentControlState.Normal;
                                break;
                        }
                    }
                }
                catch (Exception ex) { }
            }
        }
    }

  2. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 27 Apr 2011 Link to this post

    Hi vinay uthappa,

     Could you please tell us what dll version you're using because I tried the code that you send us and everything was working fine. I've attached the sample project that I used (I've just set a little bit bigger size to the items and update the fluid state on load too) so could you please examine it and see if it helps you?

    Best wishes,
    Zarko
    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
  3. DevCraft banner
  4. vinay Theethira
    vinay Theethira avatar
    35 posts
    Member since:
    Mar 2010

    Posted 28 Apr 2011 Link to this post

    Hi Thanks a lot for loooking into the issue,

    The same code doesnot work when i tried in Silverlight User Control, But i implimented the Same code in Silverlight Page. Dont know why is that.
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 03 May 2011 Link to this post

    Hi vinay uthappa,

    Have you tried the sample application attached here? The code snippet you sent is implemented inside a Silverlight UserControl and it works as expected on our side. However, if you manage to reproduce the issue in a small working sample and send it to us, we will definitely further investigate your case.

    Regards,
    Tina Stancheva
    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
Back to Top