Cannot embed RadTabControl into RadGridView's RowDetailsTemplate

3 posts, 0 answers
  1. Richard H
    Richard H avatar
    18 posts
    Member since:
    May 2006

    Posted 17 Sep 2011 Link to this post

    Hi There,

    I am having a problem in my Silverlight 4 project. If I nest a RadTabControl in a RowDetailsTemplate of the RadGridView control, at runtime when I try to expand the row details, the following error is logged in the output window and the details panel is not displayed:
    System.Windows.Data Error: ConvertBack cannot convert value 'Visible' (type 'System.Windows.Visibility'). BindingExpression: Path='DetailsVisibility' DataItem='[GVR: Item=b;]' (HashCode=4368081); target element is 'Telerik.Windows.Controls.GridViewToggleButton' (Name=''); target property is 'IsChecked' (type 'System.Nullable`1[System.Boolean]').. System.Windows.Markup.XamlParseException: Set property 'System.Windows.Controls.ContentControl.Content' threw an exception. [Line: 26 Position: 25] ---> System.ArgumentNullException: Value cannot be null.
    Parameter name: element
       at MS.Internal.XcpImports.ItemsControl_GetItemsOwner(DependencyObject element)
       at System.Windows.Controls.ItemsControl.ItemsControlFromItemContainer(DependencyObject container)
       at Telerik.Windows.Controls.ItemsControl.ItemsControlFromItemContainer(DependencyObject container)
       at Telerik.Windows.Controls.RadTabItem.get_Owner()
       at Telerik.Windows.Controls.RadTabItem.get_HasOwner()
       at Telerik.Windows.Controls.RadTabItem.OnContentChanged(Object oldContent, Object newContent)
       at System.Windows.Controls.ContentControl.OnContentChanged(IntPtr nativeTarget, CValue& oldContentValue, CValue& newContentValue)
       --- End of inner exception stack trace ---
       at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
       at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
       at MS.Internal.XcpImports.DataTemplate_LoadContent(DataTemplate template)
       at System.Windows.DataTemplate.LoadContent()
       at Telerik.Windows.Controls.GridView.DetailsPresenter.LoadDetailsElement()
       at Telerik.Windows.Controls.GridView.DetailsPresenter.UpdateDetailsElement()
       at Telerik.Windows.Controls.GridView.DetailsPresenter.UpdateVisibility()
       at Telerik.Windows.Controls.GridView.DetailsPresenter.Telerik.Windows.Data.IWeakEventListener<System.ComponentModel.PropertyChangedEventArgs>.ReceiveWeakEvent(Object sender, PropertyChangedEventArgs args)
       at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
       at Telerik.Windows.Controls.GridView.DetailsProvider.OnPropertyChanged(PropertyChangedEventArgs args)
       at Telerik.Windows.Controls.GridView.DetailsProvider.OnPropertyChanged(String propertyName)
       at Telerik.Windows.Controls.GridView.DetailsProvider.set_Visibility(Visibility value)
       at Telerik.Windows.Controls.GridView.GridViewRow.OnDetailsVisibilityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at Telerik.Windows.PropertyMetadata.PropertyChangeHook.OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
       at System.Windows.DependencyPropertyListener.set_Value(Object value)
       at System.Windows.PropertyAccessPathStep.set_Value(Object value)
       at System.Windows.Data.BindingExpression.UpdateValue().

    My XAML is as follows:
    <UserControl x:Class="ReproProblem.MainPage"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400" >
     
        <Grid x:Name="LayoutRoot" Background="White">
            <telerik:RadGridView ItemsSource="{Binding MyData}">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewToggleRowDetailsColumn/>
                </telerik:RadGridView.Columns>
                <telerik:RadGridView.RowDetailsTemplate>
                    <DataTemplate>
                        <Grid>
                            <telerik:RadTabControl>
                                <telerik:RadTabItem Header="Test">
                                    <Button Content="Test"/>
                                </telerik:RadTabItem>
                            </telerik:RadTabControl>
                        </Grid>
                    </DataTemplate>
                </telerik:RadGridView.RowDetailsTemplate>
            </telerik:RadGridView>
        </Grid>
    </UserControl>

    CodeBehind is as follows:
    using System.Collections.Generic;
    using System.Windows.Controls;
     
    namespace ReproProblem
    {
        public partial class MainPage : UserControl
        {
            public MainPage()
            {
                MyData = new List<string>() { "a", "b", "c" };
                InitializeComponent();
                this.DataContext = this;
            }
            public List<string> MyData { get; set; }       
        }
    }

    I am using Silverlight 4 for my project (but also have the Silverlight 5 RC tools installed). I am also using RadControls for Silverlight - Build 2011.2.823.1040.

    Thanks very much!
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 19 Sep 2011 Link to this post

    Hello Richard H,

    I have tried to reproduce the issue you reported, but without any success. Would you take a look at the sample attached to verify whether I am missing something ?
     

    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Richard H
    Richard H avatar
    18 posts
    Member since:
    May 2006

    Posted 19 Sep 2011 Link to this post

    Hi Maya,

    Thanks for the quick reply!

    When I open and run your sample, the problem still occurs. Do you have both the Silverlight 4 Tools and the Silverlight 5 RC Tools installed into Visual Studio 2010 SP1? I'm asking because that is what I have setup in my development environment and I suspect it may be related to installing the Silverlight 5 RC Tools. It was my understanding that installing the SL 5 RC Tools "shouldn't" have affected my SL4 project, but I'm not convinced because I have see other cases where that was not true.

    Thanks,
    Richard
Back to Top