Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1140
Help sample needed.
posted

I have a tree that has been populated with data. I go off the view and then when I come back into the view I want the tree to expand automagically to the place it was before.

My current code is at:  https://bwstage.gates.com/goodreasons/pslite.7z

database is https://bwstage.gates.com/goodreasons/pslite.bak

Steps to reproduce are: on the left hand side select down to engine level (pass car, acura, 2012, etc,ect)

Then click on the Add Application at the top, then click back to Home (top right) which will bring you back to the previous page. I am trying to get the tree to auto-expand here.

 

I get the first Leaf expanded, but then when I do this:

TreeObject.ActivateItem = xamTreeItem within the event, it seems to shut off event notifications.

So the child items never expand out.

 

Any solution to this?

 

Here is my new sample function that should do this:

 

 

 

      private void expandTreeData()

      {

         if (prdAppSVM.Current_eqa == null)

            return;

 

 

 

         foreach (XamTreeItem xti in vwEqTree.Items)

         {

            if ((string)xti.Header == prdAppSVM.Current_eqa.EquipmentClass)

            {

               //prdAppSVM.PopulateDropClass();

               vwEqTree.ActiveItem = xti;

               currItems =  xti.Items;

               xti.IsExpanded = true;

               //prdAppSVM.LoadMakes((string)xti.Header, xti);

            }

         }

 

         foreach (XamTreeItem xti in currItems)

         {

            if ((string)xti.Header == prdAppSVM.Current_eqa.EquipmentMake)

            {

 

               vwEqTree.ActiveItem = xti;

                currItems =  xti.Items;

               xti.IsExpanded = true;

               //prdAppSVM.LoadMakes((string)xti.Header, xti);

            }

         }

 

         foreach (XamTreeItem xti in currItems)

         {

            if ((string)xti.Header == prdAppSVM.Current_eqa.EquipmentYear)

            {

 

               vwEqTree.ActiveItem = xti;

               currItems = xti.Items;

               xti.IsExpanded = true;

               //prdAppSVM.LoadMakes((string)xti.Header, xti);

            }

         }

 

         foreach (XamTreeItem xti in currItems)

         {

            if ((string)xti.Header == prdAppSVM.Current_eqa.EquipmentType)

            {

 

               vwEqTree.ActiveItem = xti;

               currItems = xti.Items;

               xti.IsExpanded = true;

               //prdAppSVM.LoadMakes((string)xti.Header, xti);

            }

         }

 

         foreach (XamTreeItem xti in currItems)

         {

            if ((string)xti.Header == prdAppSVM.Current_eqa.EquipmentModel)

            {

 

               vwEqTree.ActiveItem = xti;

               currItems = xti.Items;

               xti.IsExpanded = true;

               //prdAppSVM.LoadMakes((string)xti.Header, xti);

            }

         }

 

         foreach (XamTreeItem xti in currItems)

         {

            if ((string)xti.Header == prdAppSVM.Current_eqa.EquipmentEngine)

            {

 

               vwEqTree.ActiveItem = xti;

               currItems = xti.Items;

               xti.IsExpanded = true;

               //prdAppSVM.LoadMakes((string)xti.Header, xti);

            }

         }

      }