tabcontrol

Why doesn't BackColor work for TabControls in .NET?

坚强是说给别人听的谎言 提交于 2020-01-06 07:29:45
问题 If you use the standard tab control in .NET for your tab pages and you try to change the look and feel a little bit then you are able to change the back color of the tab pages but not for the tab control. The property is available, you could set it but it has no effect. If you change the back color of the pages and not of the tab control it looks... uhm quite ugly. I know Microsoft doesn't want it to be set. MSDN: ' This property supports the .NET Framework infrastructure and is not intended

Deny Switching to Tabpage in a tabcontrol

痞子三分冷 提交于 2020-01-06 06:57:20
问题 I have a form(C#) with a tab control and its has around five tab pages. each of the tab have a few textboxes. 1) if a User is in say Tab A and edits certain fields i need to validate the text enetered if found invalid then i should not allow any tab switch ? is that possible? 2) Another case could be ... user edits some values and clicks on another tab, on doing so i need to check if the values that were enetered for Tab A is correct or not ? can i do this? I am a novice to C#... so may be

WPF TabControl Templating

老子叫甜甜 提交于 2020-01-05 04:37:26
问题 I am a new WPF user and I am trying to wrap my head around templating. In particular I am trying to template a TabControl. I am confused by the controls that actually get generated when the TabControl is bound to data. What I need is for each tab to have a separate copy of the controls in it's content section. What I have found is that it appears that a single set of controls are created, and when the user clicks from tab to tab, just the bound data changes. Project Description: The example

How to delete a Tab Item based off of it's name or header

心不动则不痛 提交于 2020-01-05 04:14:21
问题 This question is similar to this question I asked earlier today. The difference is, now I would like to delete a Tab Item referenced by it's name or header . Can I call Remove in a fashion similar to the answer I got on this question? This is what I've tried: tabControl.Items.Remove = tabControl.Items //Changes tab according to TreeView .OfType<TabItem>().SingleOrDefault(n => n.Name == stringValue); Can I use something like this? If so, how? 回答1: I don't know much about removing from wpf,

How to change the font property of a tab control without changing the font of its child controls in C#?

允我心安 提交于 2020-01-03 20:57:18
问题 I want to change the font of a tab control because I want the text in the tab page headers to look bigger. But when I change the font property of a tab control in the Designer (I'm using MS VStudio 2010), the font of its child controls change as well (such as labels and treeview) which I don't intend to do. I just want to change the tab pages' header's font. edit: i thought of changing the font property (if there is) of the child controls of the tab control in code by looping through the

How to change the background color of unused space tab in C# winforms?

风流意气都作罢 提交于 2020-01-03 15:35:33
问题 Ex |Tab1|Tab2|Tab3| { } | | | | | | | | |_____________________| I am able to change the backcolor and forecolor of Tab .. but I want to change the color of that { } -- > Empty space is this possible to do that. .. It shows default winforms color..help me in dis.. private void Form1_Load(object sender, EventArgs e) { } private void tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { Font fntTab; Brush bshBack; Brush bshFore; if ( e.Index == this.tabControl1

Dynamically add tabs to TabControl container

笑着哭i 提交于 2020-01-03 09:09:34
问题 I have a form in which I would like to be able to add tabs dynamically through the use of a button (much like the buttons most modern browsers have for adding tabs). These tabs should also contain a text box which is stretched to the individual tab's width and height upon creation. I apologise for the lack of code but besides instantiating a TabControl container within a Form class, I have no clue as to what I should do next. Thanks in advance. 回答1: All you need is to call the Add method on

selectionChanged event firing exceptions for unknown reasons

江枫思渺然 提交于 2020-01-02 20:24:50
问题 hello i got a problem, whenever i try to write any simple thing inside the TabControl_SelectionChanged event i am getting this message An unhandled exception of type 'System.InvalidOperationException' occurred in WindowsBase.dll Additional information: Dispatcher processing has been suspended, but messages are still being processed. for example: this is my xaml: <Window x:Class="try1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas

wpf custom TabControl

扶醉桌前 提交于 2020-01-02 10:32:49
问题 I really just want a TabControl that has custom TabItems that are closable, based on code from here. I thought that this question was the same as mine, but the combination of code & xaml below leaves empty tabs. public class ClosableTabControl : TabControl { protected override DependencyObject GetContainerForItemOverride() { return new ClosableTabItem(); } } <uc:ClosableTabControl x:Name="Items" Grid.Column="1"> <uc:ClosableTabControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding

adding tabs to tabcontrol from inside usercontrol

拥有回忆 提交于 2020-01-02 08:15:12
问题 How can I add tabs to a tabcontrol that exists in one usercontrol from another usercontrol that is contained within a tab itself?? Can I do it without passing in the tabcontrol as a parameter in the constructor, perhaps via some static global method? I've tried public static ObservableTabCollection FindCollectionFromUC(this DependencyObject depObject) { bool loop = true; var parent = (VisualTreeHelper.GetParent(depObject) as FrameworkElement); while (loop) { if (parent.GetType() is typeof