v
Not logged inv
SearchAsk a QuestionReport an IssueMake a SuggestionMy Questions and Issues
Issue Details
Find By ID

When two navigation items are associated with the same List View, selection of one of these items leads to the selection of the other one

Issue Details

Log in to Track Changes or Edit
B132935
Bug Report
Jascha
Yes
Processed
Fixed
Yes
.NET
eXpressApp Framework
8.3.3
v2008 vol 3.4
Windows Vista
Microsoft Visual Studio 2008
1/28/2009 3:05:38 PM
-> Created by Jascha 1/13/2009 1:23:37 PM
Description
Steps to Reproduce
Actual Results
Expected Results

Attachment: Solution3.zip (32861 bytes)

Hi,

There is a bug in navigation. If you have two navigation items in different groups that show the same class, then selecting the navigation item in the second group causes the navigation item in the first group to be selected.

This is a showstopper bug since a solution cannot released with this behaviour - could you give me a workaround asap please?

Jascha

<- Processed (Fixed), Reproduced by DevExpress Team 1/13/2009 1:53:46 PM
-> Public Fix Requested for v2008 vol 3 by Jascha 1/13/2009 6:30:14 PM
-> Reactivated by Jascha 1/20/2009 3:11:39 PM

Hi,

It's a week since I requested a fix for this urgent issue. I notice that it says "fix requested for 8.3.4" - since it is fixed in 8.3.4, why would I need a fix for that? I need one now for 8.3.3 - I cannot release a version at things stand - how can get it?

Jascha

<- Processed (Fixed) by DevExpress Team 1/20/2009 3:51:43 PM

Hello Jascha,

Thank you for the update on this, and please accept our apologies for the delay in providing you with a public fix. We will publish it once we have our internal builds tested and passed, because we cannot provide you with a broken build. It may require some time, because this will be a daily build.

Currently, as a workaround you can handle the CustomUpdateSelectedItem event of the ShowNavigationItemController class as shown in the code below:

[C#]

private bool updating;
...
        void controller_CustomUpdateSelectedItem(object sender, CustomUpdateSelectedItemEventArgs e) {
            if(updating) return;
            try {
                updating = true;
                ShowNavigationItemController controller = (ShowNavigationItemController)sender;
                ViewShortcut correctedShortcut = controller.Window.View.CreateShortcut();
                e.Handled = true;
                controller.UpdateSelectedItem(correctedShortcut);
            }
            finally {
                updating = false;
            }
        }
...
Please let us know in case of any difficulty.

Thanks,
Dennis

-> Reactivated by Jascha 1/20/2009 4:15:20 PM

Hi Dennis,

Thanks for the quick response. Unfortunately it does not work! I have traced the code and it runs when selecting a navigation item but the same behaviour occurs when the 2 navigation items reference the same listview. I have included all the code below to make sure I have done it right.

Jascha

  /// <summary>
  /// Bug fix: fix navigation issue in 8.3.3 https://www.devexpress.com/issue=B132935
  /// </summary>
  public class FixIssueB132935Controller : WindowController
  {
    public FixIssueB132935Controller()
    {
      base.TargetWindowType = WindowType.Main;
    }

    protected override void OnActivated()
    {
      ShowNavigationItemController controller = Frame.GetController<ShowNavigationItemController>();
      if (controller != null)
        controller.CustomUpdateSelectedItem += new EventHandler<CustomUpdateSelectedItemEventArgs>(controller_CustomUpdateSelectedItem);
    }

    protected override void OnDeactivating()
    {
      ShowNavigationItemController controller = Frame.GetController<ShowNavigationItemController>();
      if (controller != null)
        controller.CustomUpdateSelectedItem -= new EventHandler<CustomUpdateSelectedItemEventArgs>(controller_CustomUpdateSelectedItem);
    }

    private bool updating;

    void controller_CustomUpdateSelectedItem(object sender, CustomUpdateSelectedItemEventArgs e)
    {
      if (updating) return;
      try
      {
        updating = true;
        ShowNavigationItemController controller = (ShowNavigationItemController)sender;
        ViewShortcut correctedShortcut = controller.Window.View.CreateShortcut();
        e.Handled = true;
        controller.UpdateSelectedItem(correctedShortcut);
      }
      finally
      {
        updating = false;
      }
    }

  }

<- Processed (Fixed) by DevExpress Team 1/21/2009 3:12:13 PM

Attachment: dxSampleB132935.zip (31843 bytes)

Hello Jascha,
 
After several hours of investigating, we have just found out why the workaround solution may not work for you, but work perfectly for us here. I am sure that you tested it with the sample project you sent us previously. The fact is that in your sample, you show views with the same ID. That's incorrect. You should show only views with various IDs, even if they are of the same class. This behavior is by design.
I have corrected your sample, and now it works fine.
 
Thanks,
Dennis

-> Reactivated by Jascha 1/21/2009 3:42:47 PM

Hi Dennis,

Thanks for looking into this for me and letting me know the solution. While I can create separate list views for each navigation item, I am not sure why this should have to be the case - it seems to be an unnecessarily restrictive design. In many cases, the same lists of data would need to be present in various modules. For example, you would expect a customer list to appear in CRM, Sales and Helpdesk modules. I would note that the behaviour in this issue did not occur in previous XAF versions (e.g. 8.2) so it was not by design then - I am guessing that this was not a deliberate change (it was not on the migration notes). In general, I try not to create any unnecesary views since it is hard enough to manage them in the model editor as things stand (One solution has 50+ pages of views)!

Is it worth making a suggestion to restore the behaviour to how it was before so we can reuse views in different navigation groups? is there any workround for this in the meantime?

Many thanks,

Jascha

<- Processed (Fixed) by DevExpress Team 1/21/2009 4:50:29 PM

Jascha,

>>
Is it worth making a suggestion to restore the behaviour to how it was before so we can reuse views in different navigation groups? is there any workround for this in the meantime?
<<
Thank you for the feedback, it's is too late to revert back to the changes in the current versions to force it to work the same way as in the previous major version. The reason for the changes is that we cannot correctly handle a situation when there are several items in the navigation control with the same ID, in other words we cannot selectively determine which item to select when there are two such items corresponding to one ID. By default, it is easier to have various IDs, and it will work by default and without any problems.
Also, we cannot promise that we can accomplish your suggestion in the near future, because there is also a simple workaround for a case when you want to have equivalent IDs for views in the navigation control.
Please have a look at the following controller:

[C#]

public class FixIssueB132935Controller : WindowController
    {
        public FixIssueB132935Controller()
        {
            base.TargetWindowType = WindowType.Main;
        }

        protected override void OnActivated()
        {
            ShowNavigationItemController controller =
Frame.GetController<ShowNavigationItemController>();
            if (controller != null)
                controller.CustomUpdateSelectedItem += new
EventHandler<CustomUpdateSelectedItemEventArgs>(controller_CustomUpdateSelectedItem);
        }

        protected override void OnDeactivating()
        {
            ShowNavigationItemController controller =
Frame.GetController<ShowNavigationItemController>();
            if (controller != null)
                controller.CustomUpdateSelectedItem -= new
EventHandler<CustomUpdateSelectedItemEventArgs>(controller_CustomUpdateSelectedItem);
        }

        void controller_CustomUpdateSelectedItem(object sender, CustomUpdateSelectedItemEventArgs e)
        {
            ShowNavigationItemController controller = (ShowNavigationItemController)sender;
            ViewShortcut currentShortcut =
Application.GetCompletedViewShortcut((ViewShortcut)controller.ShowNavigationItemAction.SelectedItem.Data);
            ViewShortcut correctedShortcut = controller.Window.View.CreateShortcut();
            if (correctedShortcut.Equals(currentShortcut))
            {
                e.Handled = true;
            }
        }

    }
Does this meet your needs?

Thanks,
Dennis

<- Public Fix Published for v2008 vol 3 by DevExpress Team 1/23/2009 12:57:45 PM
Log in to Track Changes or Edit

Peer-to-Peer Discussion in DevExpress Forums

No discussion on this article has been started yet.

Please login to start discussion.

v
v
Search
Searching Tips