Binding Fails after switching between Panes in Rad Pane Group

11 posts, 0 answers
  1. Randy Gouge
    Randy Gouge avatar
    3 posts
    Member since:
    Jun 2010

    Posted 12 Oct 2010 Link to this post


    Hi,

        We are using Prism, MVVM and rad docking.  I have two Panes (Pane1 and Pane2) as modules injected at application startup ... each Pane displays some client information.  In a seperate Pane I have a tree view listing all clients.  When a client is selected the information in the Panes (Pane1 and Pane2) are updated.  The Panes, Pane1 and Pane2, are bound to seperate view models.  The view models implement the IPropertyChangedNotification interface.  The information on the Pane1 and Pane2 are updated until you change panes (ie.  the UI is updated with the new client information on Pane1 ... and continues to be updated on Pane2 as you scroll through the list of clients but when you switch back to Pane1 the UI no longer updates ... similarly if you revisit Pane 2 ... the UI is no longer updating.)

    Stepping through the debugger we noticed that in the FirePropertyChanged event below PropertyChanged was now null (it wasn't originally when the UI was being updated).  Am I doing something incorrectly here or is this a problem with the control.


     

     

     

        public class SelectedClientViewModel : PropertyChangedImplementation
        {
      
            public SelectedClientViewModel(IClientService clientService, IEventAggregator eventAggregator)
            {
                this._clientService = clientService;
      
                SelectedClientChangedEvent evt = eventAggregator.GetEvent<SelectedClientChangedEvent>();
                evt.Subscribe(OnSelectedClientChangedEvent);
            }
      
            public void OnSelectedClientChangedEvent(Client newClient)
            {
                _currentClient = newClient;
      
                FirePropertyChanged("name");
                FirePropertyChanged("address");
                FirePropertyChanged("city");
                FirePropertyChanged("country");
                FirePropertyChanged("telephone");
                FirePropertyChanged("province");
            }
      
    ...
      
      public class PropertyChangedImplementation : INotifyPropertyChanged
      {
        public event PropertyChangedEventHandler PropertyChanged;
      
        protected void FirePropertyChanged(string property)
        {
          if (PropertyChanged != null)
          {
            PropertyChanged(this, new PropertyChangedEventArgs(property));
          }
        }
      }

    Thanks,
    Randy

    If you need additional info please let me know.

     

     

  2. George
    Admin
    George avatar
    1332 posts

    Posted 15 Oct 2010 Link to this post

    Hi Randy,

    If PropertyChanged  is null, this means that nothing handles the PropertyChanged event. I am shooting in the dark here. If you send us more information about the problem, it will be very helpful.

    I will be glad to assist you further.

    Regards,
    George
    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. UI for WPF is Visual Studio 2017 Ready
  4. Randy Gouge
    Randy Gouge avatar
    3 posts
    Member since:
    Jun 2010

    Posted 15 Oct 2010 Link to this post


    Hi George,

    I've used the work around listed in a previous post from March/May of this year.  Your team provided a work around by setting the datacontext to the content instead of the RadPane (i.e. (this.Content as FrameworkElement).DataContext = _vm;).

    There appears to be a problem with the control and switching between panes ... we have the latest version of the controls installed.  Is a fix for this expected to be coming soon.

    Thanks

    Randy
  5. George
    Admin
    George avatar
    1332 posts

    Posted 20 Oct 2010 Link to this post

    Hi Randy,

    We will greatly appreciate a sample project of yours. It will definitely help us in order to test if the bug still persists in your scenario.

    I will be glad to assist you further.

    Sincerely yours,
    George
    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
  6. Mike Henders
    Mike Henders avatar
    11 posts
    Member since:
    May 2006

    Posted 04 Nov 2010 Link to this post

    George,

    I hit the same bug and worked around it by wrapping my content in a UserControl, wrapping the RadPane around the UserControl, and then binding the UserControl to my ViewModel.  It's one additional XAML file in my project for each View but I don't lose the binding.

    Something for Telerik when investigating the bug.  I wrote an event handler for RadPane.DataContextChanged and set a breakpoint in the debugger inside it to try to catch the point at which the binding was being lost.  The breakpoint was hit when the DataContext was initial bound to my ViewModel class but it was never hit when the binding was lost and the DataContext was set back to null.

    Cheers,
    Mike
  7. George
    Admin
    George avatar
    1332 posts

    Posted 10 Nov 2010 Link to this post

    Hi Mike,

    Thank you for this information. We will use it in further pinpointing and resolving the problem.

    Regards,
    George
    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
  8. Chris
    Chris avatar
    7 posts
    Member since:
    Oct 2010

    Posted 22 Nov 2010 Link to this post

    Hi,

    Just wondered if there was any update on this issue.

    We're suffering the exact same behaviour and could really do with a fix.

    Chris.
  9. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 23 Nov 2010 Link to this post

    I'm apparently having the same problem. I the workaround that Randy mentioned about setting the DataContext of the content instead of the pane and so far it appears to be working. I was even able to register the propertyChanged event on the viewModel to set the Pane's header content. Thanks for the help!
  10. Anders
    Anders avatar
    80 posts
    Member since:
    Dec 2010

    Posted 23 Feb 2011 Link to this post

    Just want to add that the problem is still there - I'm using RadControls_for_WPF40_2010_3_1314_Dev.msi

    I finally found this thread, but it cost me a few days of frustrations while trying to pinpoint the problem.

    Maybe you could list it as a known issue? Or have yo already and I overlooked it?

    I used the work-around described above - due to DataContextChanged not firing when the Rad-control changes the datacontext, I get only 'legitimate' events and set the DataContext of the needing controls inside the RadPane on that event.

    (It gets me moving on, but it is indeed a hack)

    Happy coding guys!

    Anders, Denmark
  11. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 01 Mar 2011 Link to this post

    Hi Rayne,

    We are currently working on a major rewrite of RadDock for WPF due to some performance issues and problems with the current implementation of the control. However the new version will not make it for Q1 2011 and will be introduced either with the service pack or for the Q2 Beta. We will do our best to resolve this issue with the new version. For now  you have to use the workaround.

    Sorry for the inconvenience caused. Don't hesitate to contact us if you have other questions.

    Kind regards,
    Boyan
    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!
  12. jagmohan
    jagmohan avatar
    4 posts
    Member since:
    Mar 2011

    Posted 08 May 2011 Link to this post

    hello admin. i am facing the same problem. i have dependency properties in radpane, once i bind a property it works normally. but as soon as i "PINNED" the radpane the binding doesnt work properly. i have to perform the binding again...
    please suggest me a way out.
Back to Top
UI for WPF is Visual Studio 2017 Ready