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
I'm sorry but I have no such sample. You should be able to create and manage your own Dictionary<> probably keyed by Record and the value being the TabItem. If it exists in the dictionary then you can just activate that one. If it doesn't then create the tab and add it to the dictionary. In either case you would focus/activate that tabitem. You would also have to manage updating that dictionary if you remove a tab item.
can you give me a sample for the same.
Thanks,
Thanks Smith. i didn't mark the event. Its working fine now.
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.
Ritesh_2009 said: 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?
Are you marking the event as handled (i.e setting e.Handled = true in the MouseDoubleClick event)?