I am using the DevComponents TabNavigation control for WPF, and I am able to add a new tab for tabulation in a specific index,
It's a code-behind, let me call it now I want to select the new tab:
Private Zero Text Block_MouseLeftButtonDown (Object Sender, MouseButtonEventArgs e) {int i = createNewTabItem (0 , "Foo"); TabNavigation tn = ((Sender as TextBlock). As Grid). Original as TabItem). Parents as TabNavigation; Tn.SelectedItem = tn.Items [i]; } Private Ent NantabItem (IT OverflowRP paging, string header) {TabItim TI = new tabitum (); Ti.Header = Header; TabNavigation.Items.Instert (overflowrp pg + 1, ti); Return overprococracPageN + 1; } When I run this code, instead of viewing the new tab, it is brought to view and then the original tab I was on quickly back in view has come.
If someone is having this happen, and how can they decide, please tell me. I've attached a sample of XAML below:
& lt; Grid & gt; & Lt; Grid.Resources & gt; & Lt; ResourceDictionary & gt; & Lt; Style TargetType = "TextBlock" & gt; & Lt; Style.Triggers & gt; & Lt; Trigger Property = "Ismouth Over" Value = "True" & gt; & Lt; Setter property = "textcurrency" value = "underline" & gt; & Lt; / Setter & gt; & Lt; / Catalyst & gt; & Lt; /Style.Triggers> & Lt; Setter Property = "Foreground" Value = "White" /> & Lt; Setter Property = "FontFamily" value = "Segoyi UI" /> & Lt; Setter property = "font size" value = "11" /> & Lt; Setter property = "fontwhite" value = "bold" /> & Lt; Setter property = "horizontal alignment" value = "true" /> & Lt; Setter property = "text" value = "and see ..." /> & Lt; Setter property = "visibility" value = "view" /> & Lt; EventSetter Event = "Mouse LeftButtondown" Handler = "lblMoreCpartys_MouseLeftButtonDown" /> & Lt; / Style & gt; & Lt; / ResourceDictionary & gt; & Lt; /Grid.Resources> & Lt; My: TabNavigation background = "black" HorizontalAlignment = "muscle" margin = "0" name = "tabNavigation" VerticalAlignment = "muscles" MouseLeftButtonDown = "tabNavigation_MouseLeftButtonDown" FONTSIZE = "12" foreground = "SteelBlue" ForceCursor = "right" mousewheel = "Tab Navigation_mouse Whiplash" tabstripplacement = "bottom" & gt; & Lt; TabItem header = "item 1" name = "first tab unit" font sieces = "12" & gt; & Lt; TextBlock Name = "First TB" /> & Lt; / TabItem & gt; & Lt; TabItem header = "ITE 2" name = "second tab item" font system = "12" & gt; & Lt; Text block name = "seconds" /> & Lt; / TabItem & gt; & Lt; / My: TabNavigation & gt; & Lt; / Grid & gt; Thanks in advance.
Try setting the E. in the text to correct in BLOCK_MouseLeftButtonDown
I am not familiar with that control, but if the tab works like a control line then it has logic to see a tab when clicked. It logically looks that the original tab was clicked, and after your change came to see it back. Marking eventArgs objects as handled will prevent WPF from calling event handlers on parent elements, which will prevent the tab from switching back.
Comments
Post a Comment