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
1655
Set Focus to Tab Item in XamTabControl
posted

Hi,

I have an XamDataGrid which contains (say) master records.

This grid is inside a XamTabControl. I have two context menu for the Grid: View and Edit. The menu will open a user control in a tab  item based on the mode.(See below for the code to add a tab)

TabItemEx tabLookUp = new TabItemEx();
            tabLookUp.Header = ""Tab;
            tabLookUp.AllowClosing = true;
            tabLookUp.HorizontalAlignment = HorizontalAlignment.Right;
            this.xamTabLookUpType.Items.Add(tabLookUp);
            tabLookUp.Content = new LookUpDetails(LookUpType, IsViewMode);
            tabLookUp.Focus();

In the above scenario the statement "tabLookUp.Focus()" works absolutelly fine and the focus is set to the newely opened tab item.

I have another functionality where on double clicking a record in the grid, a new tab item should be opened in view mode.

But when i double click on a record of the grid the focus is not set to the new tab item.

Can you please tell me what would the problem be and how to solve it?

And one more question how do i restrict opening of the tab item for the same record.

Eg: If i view a record in view mode, i should not be allowed to view the same record in view mode. But, in Edit mode it should allowed me. Same applies for Edit mode also.

Thanks & Regards,

Varun R

Parents
  • 54937
    Offline posted

    Ritesh_2009 said:

    And one more question how do i restrict opening of the tab item for the same record.

    Eg: If i view a record in view mode, i should not be allowed to view the same record in view mode. But, in Edit mode it should allowed me. Same applies for Edit mode also.

    I'm not sure what you mean but if you're asking how to prevent creating a tab for an item for which you have already created a tab then perhaps you should maintain a dictionary of the TabItem you have created for a given record and then if you have already created one then you would just focus that one without creating a new one.

Reply Children