tabcontrol

Loop through controls in TabControl

时光毁灭记忆、已成空白 提交于 2019-12-05 14:37:56
I am looking for a way to loop through controls on a particular tab of a tabcontrol. For example, I have a tabcontrol with the following tabs: Cars, Pets, Admin On each of these tabs are several controls to display/edit/save data, etc. On the "Save" button, I would like to loop through the controls for that particular tab to check whether all required fields have been filled in. So, if I am on the Cars tab and click "Save," I want to loop ONLY through the controls on the Cars tab and NOT the Pets or Admin tabs. How can achieve this result? Joseph As for looping through a TabControl's controls,

How to make TabPages draggable?

两盒软妹~` 提交于 2019-12-05 12:29:04
I'd like to enable user to rearrange TabPages order by dragging and dropping. Moreover it'd be cool to enable user to drag TabPages from one TabControl to another. Both the way like in Firefox and Total Commander. How to achieve this? reordering TabPages with drag and drop - by Ludwig B. inspired by http://dotnetrix.co.uk/tabcontrol.htm#tip7 private void tc_MouseDown(object sender, MouseEventArgs e) { // store clicked tab TabControl tc = (TabControl)sender; int hover_index = this.getHoverTabIndex(tc); if (hover_index >= 0) { tc.Tag = tc.TabPages[hover_index]; } } private void tc_MouseUp(object

How to display the same control on two different tabs?

核能气质少年 提交于 2019-12-05 07:02:42
I'm using VB.NET I need same control (ListBox) to be displayed on 2 different tabs. Is it mandatory to create 2 different ListBox instances? If you don't need design-time support you can simply, at runtime, change the ListBox instance's Parent from one tab to the other (making sure to set the positioning appropriately, of course). Essentially, it's: listBox1.Parent = tabControl1.TabPages[1]; In the end though, you'll probably find it easier to just have two ListBox's with the same data source. Yes, I think you'll need a ListBox control on each tab. If they have the same data you can use the

TabControl: all TabItems collapsed, but content of 1st TabItem still visible

牧云@^-^@ 提交于 2019-12-05 01:53:55
问题 I've got a rather strange behavior on a TabControl, whose TabItems are all collapsed: The content of the first TabItem is still visible (but the header is not). The TabControl and its TabItems are setup like this: <TabControl> <TabItem Header="Data 1" Visibility="{Binding Path=DataTable1.HasRows, Converter={StaticResource BoolToVisibility}}"> <UI:ShowData DataContext="{Binding Path=DataTable1}"/> </TabItem> <TabItem Header="Data 2" Visibility="{Binding Path=DataTable2.HasRows, Converter=

How to add new user control in TabControl.ContentTemplate?

心已入冬 提交于 2019-12-05 01:03:03
问题 I am little stuck with adding new instances of a usercontrol in a TabControl.ContentTemplate ? My Xaml is here: <TabControl ItemsSource="{Binding Tables}"> <TabControl.ItemTemplate> <DataTemplate> </DataTemplate> </TabControl.ItemTemplate> <TabControl.ContentTemplate> <DataTemplate DataType="{x:Type uc:mytest1}"> <uc:mytest1> </uc:mytest1> </DataTemplate> </TabControl.ContentTemplate> </TabControl> I am binding TabControl.ItemsSource property to an ObservableCollection and in the content

Winforms TabControl alignment problems

南楼画角 提交于 2019-12-05 00:42:14
问题 When I set TabControl alignment to Left or Right it leaves this huge space between tab buttons and tab page area. How to get rid of this useless space? TabControl.Appearance is set to Buttons because if it is set to Normal the text on buttons disappear. UPDATE: When i set TabControl.Alignment to Bottom and TabControl.Appearance to Normal buttons look inverted (orange line should be below) When i set TabControl.Alignment to Bottom and TabControl.Appearance to Buttons , There is no area on

WPF Tab Control: How do I get the currently selected tab?

懵懂的女人 提交于 2019-12-04 23:59:29
In my tab SelectionChanged event (is this the correct event, I can't find a tab changed event?), how do I access the new tab? Also from outside this event in normal code, how do I access the currently selected tab? TabControl.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(TabControl_SelectionChanged); void TabControl_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { //How so access my currently selected tab??? } MarcelDevG TabControl.SelectedItem is the selected tab. cast it to a TabItem to get the properties. What I mostly do

Can I remove the dotted focus rectangle over tabs on a TabControl?

可紊 提交于 2019-12-04 19:32:55
问题 I have a tab control and need to remove the dotted focus rectangle around the selected tab. I have set the TabStop property of the TabControl to false. However if I click on a tab and press the Tab key, the dotted rectangle appears around the tabname. I have tried creating my own TabControl and tried this class MyTabControl : TabControl { public MyTabControl() { TabStop = false; DrawMode = TabDrawMode.OwnerDrawFixed; DrawItem += new DrawItemEventHandler(DoMoreTabControl_DrawItem); Invalidate(

Closing TabItem by clicking middle button

馋奶兔 提交于 2019-12-04 17:41:39
I have a problem. In my WPF application, if i press a tabItem with middle mouse button, this tabItem should close. Just like in FireFox. But I try to do this using MVVM, and i need to use commands. Also my tabItems are created dynamically. Help me plz! Thank you! Create a DataTemplate for your tab items like this: <DataTemplate x:Key="ClosableTabTemplate"> <Border> <Grid> <Grid.InputBindings> <MouseBinding Command="ApplicationCommands.Close" Gesture="MiddleClick" /> </Grid.InputBindings> <!-- the actual contents of your tab item --> </Grid> </Border> </DataTemplate> In your application window,

How to disable XP themes in WPF application?

老子叫甜甜 提交于 2019-12-04 17:02:26
I have a WPF application (.NET 3.0, VS2008) that displays data in a tab control. Custom colors are required on virtually all controls in this application : basically white foreground and green background. My problem is that when an XP theme (say Luna) is active, it is automatically applied to render controls so that my white text is written on ... a white background. For instance on the active tab item header : I have tried : to remove the embedded manifest file from the generated application (in the project properties) : useless. to force the use of the Windows Classic theme in the