5

Closed

App freeze when behaviors are on a popup

description

When adding a behavior in a control in a popup, the app freeze because it can find the popup in the visual tree. I am gessing they are not in it. The code seems to loop in this method :

The output window keep showing endlessly : Popup Not in visual tree
private async void ConfigureDataContext()
{
  while (associatedObject != null)
  {
    if (AssociatedObjectIsInVisualTree)
    {
      Debug.WriteLine(associatedObject.Name + " found in visual tree");
      SetBinding(
          DataContextProperty,
          new Binding
          {
            Path = new PropertyPath("DataContext"),
            Source = associatedObject
          });

      return;
    }
    Debug.WriteLine(associatedObject.Name + " Not in visual tree");
    await WaitForLayoutUpdateAsync();
  }
}
Closed Apr 26, 2013 at 8:21 PM by localjoostnl

comments

localjoostnl wrote Oct 14, 2012 at 4:57 PM

Hi, I am aware of this problem but the problem with an AssociatedObject not being in the Visual Tree immediately bit me too but is fixed in changeset 18697 on Aug 17. Are you still having this problem? Have you tried the newest NuGet Package?

MatthieuN wrote Oct 17, 2012 at 8:11 AM

I installed the Library just a few days ago using NuGet and I have the problem. I will try by getting directly the Library for codeplex. But maybe you should check that the NuGet package is up to date then.

wrote Oct 25, 2012 at 4:51 PM

apuyana wrote Oct 25, 2012 at 4:53 PM

I had this problem with the version 1.02

wrote Nov 15, 2012 at 6:15 AM

marc28 wrote Jan 18, 2013 at 9:01 AM

I have the same problem with the 1.0.2 version

wrote Jan 18, 2013 at 9:01 AM

wrote Feb 14, 2013 at 7:52 PM

wrote Apr 24, 2013 at 3:54 PM

kpantos wrote Apr 24, 2013 at 3:55 PM

Same here, any news on that?

localjoostnl wrote Apr 26, 2013 at 1:40 PM

Guys, I have been looking into this today but it appears not to be that easy. I have a solution that does stop the app freezing, but then the data binding still does not work. If anyone has any suggestions, I'd be happy to implement them.

wrote Apr 26, 2013 at 8:21 PM

Resolved with changeset 24933: Popup apparently not found by VisualTreeHelper.GetParent. Checked if top parent's parent is a Popup

wrote May 16, 2013 at 9:56 AM