Floating pane loses bindings

8 posts, 0 answers
  1. Scott
    Scott avatar
    66 posts
    Member since:
    Nov 2009

    Posted 27 Jul 2011 Link to this post

    I have a RadGridView inside a RadPane. I'm using MVVM with a QueryableDomainServiceCollectionView in the ViewModel. When my RIA aplication starts data is shown in the grid. If I float the pane all the information in the grid disappears. I can then dock the pane and the data reappears.

    See attached screenshots.

    I tried the same program with 2011 Q1 SP1 and this problem didn't occur.

    I also tried to put this into PITS but when I tried to add an issue it kicked me out.
  2. Scott
    Scott avatar
    66 posts
    Member since:
    Nov 2009

    Posted 01 Aug 2011 Link to this post

    This is a very serious regression that I need help on.

    Can someone please reply? Thanks.
  3. DevCraft banner
  4. bg
    bg avatar
    19 posts
    Member since:
    Jul 2006

    Posted 01 Aug 2011 Link to this post

    I had the same issue. Telerik told me it was by design. They added a bug for me in their PITS system but will not fix this unless it gets enough votes.

    You can add another vote for it here: http://www.telerik.com/support/pits.aspx#/public/silverlight/6689

    FYI - This is only an issue if your are inheriting the DataContext. If the control has its own model thats not inherited you should be fine.
  5. Scott
    Scott avatar
    66 posts
    Member since:
    Nov 2009

    Posted 01 Aug 2011 Link to this post

    Thanks bg, I added my vote.

    Whether this is a 'bug' or not changing funcitonality that many depend on in a minor release isn't right.
  6. bg
    bg avatar
    19 posts
    Member since:
    Jul 2006

    Posted 01 Aug 2011 Link to this post

    I could not agree more. Thanks for the vote. Hopefully they will enable this down the road.
  7. Scott
    Scott avatar
    66 posts
    Member since:
    Nov 2009

    Posted 02 Aug 2011 Link to this post

    bg - I tried setting the DataContext of the Docking control directly
    DockingHome.DataContext = WebContext.Current.VMManager.ViewModel
    and I still have the same problem. Is this what you mean by not being inhereited? It is the same viewmodel object as the whole view though.
  8. bg
    bg avatar
    19 posts
    Member since:
    Jul 2006

    Posted 03 Aug 2011 Link to this post

    Scott - Sorry for the confusion. If the Control has its own dedicated model it will work just fine, but is sounds like your using an inherited model which is trying to use the same model as its parent control. In this case I just re-bind the model as a work around. Use the PaneStateChange event on the rad docking control and rebing the model:
    private void radDocking_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                foreach (RadPane pane in radDocking.Panes)
                {
                        if (pane.DataContext == null)
                            pane.DataContext = this.DataContext;
                }
            }

     

     

  9. Scott
    Scott avatar
    66 posts
    Member since:
    Nov 2009

    Posted 03 Aug 2011 Link to this post

    thanks for the help bg, that worked great. I "enhanced' or LINQified the routine a little below in case you want to use it
    private void DockingHome_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e)
    {
        // work around functionality change in RadDocking where the DataContaxt is lost when floating the pane
        RadDocking dockingControl = (RadDocking) sender;
        IEnumerable<RadPane> nullContextPanes = dockingControl.Panes.Where(p => p.DataContext == null);
        // set the DataContext if it is null
        nullContextPanes.ToList().ForEach(p => p.DataContext = ViewModel);
    }
Back to Top
DevCraft banner