Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have a TabControl region, where i am adding new tabs throw RequestNavigate method. Everything's working fine. But problem is, that new tabs are placed on the last position to the right. But i need to add them right next to active tab. So when i have 10 open tabs, but active is first tab - i want to add new opened tab to second place and move other tabs to right. Thx a lot
Ok, thanks to Sam's solution
https://stackoverflow.com/a/4285764/1027262
I figured out that there is a SortComparison property of IRegion class that is responsible for sorting views inside region.
So my View classes implements ISortableView interface, that contains
public int SortIndex {get;set;}
This SortIndex is then used for sorting Views in region. SortComparison method looks like this:
private static int CompareViews(object x, object y)
return ((ISortableView)x).SortIndex.CompareTo(((ISortableView)y).SortIndex);
this._regionManager.Regions["MyRegion"].SortComparison = CompareViews;
Then I had to make service class, that is responsible for managing Views index. Index of parent view i am sending throw OnNavigatedFrom method of INavigationAware interface. But be aware of setting SortIndex in OnNavigatedTo method. This method is called AFTER region sort its views.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.