I am writing a tabbed app, where I used a tabtron with 4 tab items, I have tab 4 I have a button, where I click on it, I want to go back to the first tab, I have selected the tab control. Selected index = 0 but it seems that it is not working, can you help?
Here is xaml
& lt; TabCentrol x: Name = "TabAdd" HorizontalAlignment = "left" height = "535" VerticalAlignment = "top" width = "645" BorderBrush = "#FFE8E8E8" padding = "0" IsSynchronizedWithCurrentItem = "true" IsTextSearchEnabled = "correct" Gt; & Lt; TabItem x: name = "TabAddFlat" header = "flat view" TabIndex = "0" & gt; & Lt ;! - IsSelected = "True" - & gt; & Lt; Grid Background = "#FFFBFBFB" margin = "0" & gt; & Lt; Grid X: Name = "GridAddFlat" HorizontalAlignment = "left" height = "466" VerticalAlignment = "top" width = "407" margin = "109,10,0,0" & gt; & Lt; Image HorizontalAlignment = "left" height = "466" VerticalAlignment = "top" width = "274" source = "resource / F18.large - Copy.png" margin = "3,0,0,0" /> & Lt; / Grid & gt; & Lt; / Grid & gt; & Lt; / TabItem & gt; & Lt; TabItem x: name = "Tabbed side" header = "side view" tabindex = "1" & gt; & Lt; TabItem.Background & gt; & Lt; LinearGradientBrush EndPoint = "0,1" Start Page = "0,0" & gt; & Lt; GradientStop color = "#FFF3F3F3" offset = "0" /> & Lt; GradientStop color = "#FFEBEBEB" offset = "0.5" /> & Lt; GradientStop color = "#FFDDDDDD" offset = "0.5" /> & Lt; GradientStop color = "#FFFBFBFB" offset = "1" /> & Lt; / LinearGradientBrush & gt; & Lt; /TabItem.Background> & Lt; Grid Background = "#FFFBFBFB" & gt; & Lt; Grid X: Name = "GridAddSide" horizontal alignment = "left" height = "345" vertical alignment = "top" width = "444" margin = "119,49,0,0" & gt; & Lt; Image horizontal alignment = "left" height = "343" vertical alignment = "top" width = "394" source = "resource / F 1. LGG .png" /> & Lt; / Grid & gt; & Lt; / Grid & gt; & Lt; / TabItem & gt; & Lt; TabItem tabindex = "3" X: Name = "TabAddInfo" header = "Customer Info" HorizontalAlignment = "left" height = "45" VerticalAlignment = "top" width = "184" margin = "0,0, -78, 0 "& Gt; & Lt; TabItem.Background & gt; & Lt; LinearGradientBrush EndPoint = "0,1" Start Page = "0,0" & gt; & Lt; GradientStop color = "#FFF3F3F3" offset = "0" /> & Lt; GradientStop color = "#FFEBEBEB" offset = "0.5" /> & Lt; GradientStop color = "#FFDDDDDD" offset = "0.5" /> & Lt; GradientStop color = "#FFE8E8E8" offset = "1" /> & Lt; / LinearGradientBrush & gt; & Lt; /TabItem.Background> & Lt; Grid Background = "#FFFBFBFB" & gt; & Lt; Grid x: Name = "GridAddInfo" horizontal alignment = "left" height = "466" workspaceElement = "top" width = "407" margin = "109,10,0,0" & gt; & Lt; TextBox x: name = "iaddress" MaxHeight = "288" height = "95" width = "288" Control: Textbox. "Center" Grid.IsSharedSizeScope = "true" padding = "0" UseLayoutRounding = "true" RenderTransformOrigin = "0.5,0.5" margin = "27246,92,125" AutoWordSelection = "true" /> & Lt; / Grid & gt; & Lt; / Grid & gt; & Lt; / TabItem & gt; & Lt; TabItem tabindex = "3" X: name = "TabAddReview" header = "review" HorizontalAlignment = "left" height = "45" VerticalAlignment = "top" width = "106" GotFocus = "LoadAddReview" & gt; & Lt; TabItem.Background & gt; & Lt; LinearGradientBrush EndPoint = "0,1" Start Page = "0,0" & gt; & Lt; GradientStop color = "#FFF3F3F3" offset = "0" /> & Lt; GradientStop color = "#FFEBEBEB" offset = "0.5" /> & Lt; GradientStop color = "#FFDDDDDD" offset = "0.5" /> & Lt; GradientStop color = "#FFFBFBFB" offset = "1" /> & Lt; / LinearGradientBrush & gt; & Lt; /TabItem.Background> & Lt; Grid Background = "#FFFBFBFB" & gt; & Lt; Image horizontal alignment = "left" height = "32" margin = "15,15,0,0" workspaceElement = "top" width = "32" source = "resource / save-64.png" mouse leftbootdowndown = "safeform" /> & Lt; / Grid & gt; & Lt; / Grid & gt; & Lt; / TabItem & gt; & Lt; / TabControl & gt; & Lt; / Grid & gt; and here is the C # code
Private Zero SaveFormAul (Object Sender, MouseBuiltEventErgus E) {TabAdd.SelectedIndex = 2; }
on the image that you are using as a button, mouse Left buttonTone = SaveFormAll "MouseLeftButtonUp =" SaveFormAll "and try again. This should work.
The problem is that your mouse is firing the left buttondown handler, but the mouse leftbuttonup event immediately follows it And puts the focus back on the image, which means that the last tab is active when I have it on MouseLeftButtonUp Changed to use, so it worked.
No comments:
Post a Comment