Current filter:
                                You should refresh the page.
                                  • Hi there,

                                    I have a split MasterDetail View setup with tabs on the DetailView.

                                    The SelectedPageChanged events works perfectly if the object in the DetailView doesn't change i.e the selected item in the ListView is the same object type as the one when the control was initially created.

                                    If you select a different type in the ListView, this causes a different DetailView to be displayed and that all works fine as expected.

                                    If you then select a row in the ListView which uses the original object type DetailView with the SelectedPageChanged event the event doesn't fire at all. I've tried subscribing to the event in both the OnActivated and OnViewControls created and it still doesn't work.

                                    I have a instance of the tab groups control which is accessible and is not null when you go back to the "original" DetailView so it's not that the TabbedGroupControl is null or anything like that. No errors are shown when running the code to subscribe to the event again.

                                    I've tried to unsubscribe in the OnDeactivated event and then resubscribe on the OnActivated event but it makes no difference.

                                    As I said, the DetailView works perfectly as long as you don't select a different object type.

                                    If you select a different object type (one that doesn't have this DetailView) then select an object type with this particular DetailView with the SelectedPageChanged event it works perfectly until you change object types just like it does if this object type is the one originally selected.

                                    So it's a case of it works perfectly until the DetailView has been used, changed and then reverted back to.

                                    How can I get the SelectedPageChanged event to fire when the types have changed?

                                    Thanks!
                                    Rich

                                Show all comments
                                • Gosha (DevExpress Support) 11.07.2019

                                  Hi Rich,

                                  Would you please clarify how you obtain a TabbedControlGroup instance? We have the How to access a tab control in a Detail View layout example that illustrates how to obtain it. Using this approach, the SelectedPageChanged event is raised correctly on my side. Would you please provide me with a sample project to reproduce the issue?

                                • Customer66028 11.07.2019

                                  Hi Gosha,

                                  I obtain the TabbedGroupInstance like this (this code is in both OnViewControlsCreated and OnActivated

                                  [C#]
                                  if (_layoutManager == null) _layoutManager = (WinLayoutManager)((DetailView)View).LayoutManager; _layoutManager.ItemCreated += _layoutManager_ItemCreated;

                                  I obtain the event handler by:

                                  [C#]
                                  private void _layoutManager_ItemCreated(object sender, ItemCreatedEventArgs e) { switch (e.ModelLayoutElement.Id) { case "Tabs": var _rightPanelTabs = (TabbedControlGroup)e.Item; _rightPanelTabs.MouseDown += _rightPanelTabs_MouseDown; _rightPanelTabs.SelectedPageChanged += TradeMappingQualityIssueViewController_RightPanel_SelectedPageChanged; break; } }

                                  Both code paths I have supplied above run when expected, in all scenarios.

                                  The MouseDown event is there as I attempted to find a different way around this issue - those events also do not trigger once the DetailView has been changed back to the "original"

                                  As I mentioned originally, the event fires as expected until you revert back from a different object. When reverting back from a different object the above code executes, no errors and nothing to give the impression the event hasn't been subscribed to.. Its just the event which I've subscribed to doesn't trigger..

                                  I'm using the CreateCustomCurrentObjectDetailViewEventArgs functionality to enable me to display the required DetailView for the selected object type.

                                  As before, it all works 100% as expected right until you switch objects and then switch back to this particular one..

                                  All the code I've pasted in here executes at the correct time i.e. OnActived, OnViewControlsCreated.

                                  It's just the event does not trigger even though I have executed the code above without error.

                                  Rich

                                • Anatol (DevExpress Support) 11.08.2019

                                  I apologize for the relay. We need additional time to research this scenario. Please bear with us.

                                • Michael (DevExpress Support) 11.11.2019

                                  Hello Rich,

                                  We couldn't reproduce the issue based on your description. Attached is a sample project that raises the TabbedGroupControl.SelectedPageChanged event as expected. Please modify it to reproduce the issue and send it back to us for review.

                                • Customer66028 11.12.2019

                                  Hi Michael,

                                  Thank you for the example application. In adjusting your example to mirror my problem I did find the underlying issue.

                                  private void _layoutManager_ItemCreated(object sender, ItemCreatedEventArgs e)
                                          {
                                              if (e.ModelLayoutElement.GetType().Name.ToLower().Contains("tab"))
                                                  Console.WriteLine(String.Format("Item Created: {0} - {1}", e.ModelLayoutElement.Id, e.ModelLayoutElement.GetType().Name));

                                              switch (e.ModelLayoutElement.Id)
                                              {
                                                  case "FrameTabs":
                                                      if (_mainFrameTabs == null)
                                                          _mainFrameTabs = (TabbedControlGroup)e.Item;

                                                      _mainFrameTabs.SelectedPageChanged += TradeMappingQualityIssueViewController_MainTabs_SelectedPageChanged;
                                                      break;

                                                  case "Tabs":
                                                      if (_rightPanelTabs == null)
                                                          _rightPanelTabs = (TabbedControlGroup)e.Item;

                                                      _rightPanelTabs.SelectedPageChanged += TradeMappingQualityIssueViewController_RightPanel_SelectedPageChanged;
                                                      break;
                                              }
                                          }

                                  If you do not set _rightPanelTabs to null in OnDeactived() then the events do not resume working.. As you can see, I was setting the scope variable _rightPanelTabs to the Control only if it hadn't already been set.

                                  I do think this is a bug in DexExpress as I already have the instance in a variable, I don't think I should have to re-set it each time..

                                  However, that is up for debate. Your assistance has helped me to solve my problem so I'm happy for this ticket to be closed.

                                  Thanks!
                                  Rich

                                • Michael (DevExpress Support) 11.12.2019

                                  Hello Rich,

                                  I cannot reproduce the issue using your code fragments. However, it is possible that the issue is caused by your controller implementation in the part of the code that you didn't share. It seems that you are caching an initially found layout element in a variable. However, when a user selects a list view row of a different type, the detail view and all its controls might be replaced. If you do not clear the cached values, you will subscribe to events of a destroyed control.

                                  Should you need further assistance with diagnosing this issue, please share the complete source code of your controller or send us a small sample project demonstrating the issue.

                                0 Solutions

                                Creation Date Importance Sort by