TabControl Reorder Losing Content

2 posts, 0 answers
  1. Jacob Rillema
    Jacob Rillema avatar
    8 posts
    Member since:
    Nov 2009

    Posted 29 Mar 2011 Link to this post

    Hi,

    I am using the latest 2011 Q1 binaries and having issues with reordering my tab items on the tab control. I am using dynamic tab items (binding) within a MVVM architectural design. I have no issue with the tabs showing up and selecting between them and preserving the states between the tabs. However whenever I click and hold one tab and drag it over another tab all content is loss on all tabbed items? This did not happen in the previous 2010 Q4 binaries. Any thoughts on what may have changed their? Internally I see the observable collection is maintaining my items correctly. The header content is just fine as well.

    Also last thing to note I in the previous release I used Expression Blend to edit/create the Telerik template to make some tweaks to the header. This caused the full blown recreation of all the styles inside the template for the radtab control. Should I have to "recreate" this with the new release? Could this be causing some of the issues?

    Quick Update: After running this in VS 2010 in debug mode I do get the exception "Value does not fall within the expected range."

    Another Update: I found out my issue. I had to update my ClearParent method to the following

     

    private static void ClearParent(FrameworkElement content)
         {
             if (content != null)
             {
                 var parent = VisualTreeHelper.GetParent(content) as ContentPresenter;
                 if (parent != null)
                 {
                     parent.Content = null;
                 }
                 var parent2 = VisualTreeHelper.GetParent(content) as ContentControl;
                 if (parent2 != null)
                 {
                     parent2.Content = null;
                 }
             }
         }

    Here is how I use it on my TabItem class.

    public FrameworkElement Content
            {
                get
                {
                    ClearParent(_content);
                    return _content;
                }
                set
                {
                    _content = value;
                    FirePropertyChanged("Content");
                }
            }


    This was what is was originally...

    private static void ClearParent(FrameworkElement content)
          {
              if (content != null)
              {
                  if (content.Parent != null)
                  {
                      var contentPresenter = content.Parent as ContentPresenter;
                      if (contentPresenter != null)
                      {
                          contentPresenter.Content = null;
                      }
                  }
                  if (content.Parent != null)
                  {
                      var contentControl = content.Parent as ContentControl;
                      if (contentControl != null)
                      {
                          contentControl.Content = null;
                      }
                  }
              }
          }

    Thanks and I hope this helps somebody out there.

    Jake 

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 04 Apr 2011 Link to this post

    Hi Jacob Rillema,

    As I managed to understand the DragReorder issue with the loss of content is still open. Unfortunately, we are unable to reproduce such behavior at our side. Could you please examine my test project and let me know if I am missing something. Thank you for your cooperation.

    Regards,
    Petar Mladenov
    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
Back to Top