This is a migrated thread and some comments may be shown as answers.

Binding Fails after switching between Panes in Rad Pane Group

10 Answers 137 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Randy Gouge
Top achievements
Rank 1
Randy Gouge asked on 12 Oct 2010, 03:25 PM

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.

 

 

10 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 15 Oct 2010, 03:17 PM
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
0
Randy Gouge
Top achievements
Rank 1
answered on 15 Oct 2010, 04:24 PM

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
0
George
Telerik team
answered on 20 Oct 2010, 01:38 PM
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
0
Mike Henders
Top achievements
Rank 1
answered on 05 Nov 2010, 02:52 AM
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
0
George
Telerik team
answered on 10 Nov 2010, 09:12 AM
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
0
Chris
Top achievements
Rank 2
answered on 22 Nov 2010, 06:30 PM
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.
0
Rayne
Top achievements
Rank 1
answered on 23 Nov 2010, 10:16 PM
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!
0
Anders
Top achievements
Rank 1
answered on 23 Feb 2011, 03:51 PM
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
0
Boyan
Telerik team
answered on 01 Mar 2011, 09:33 AM
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!
0
jagmohan
Top achievements
Rank 2
answered on 08 May 2011, 03:03 PM
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.
Tags
Docking
Asked by
Randy Gouge
Top achievements
Rank 1
Answers by
George
Telerik team
Randy Gouge
Top achievements
Rank 1
Mike Henders
Top achievements
Rank 1
Chris
Top achievements
Rank 2
Rayne
Top achievements
Rank 1
Anders
Top achievements
Rank 1
Boyan
Telerik team
jagmohan
Top achievements
Rank 2
Share this question
or