tabcontrol

How to add an icon or image to a tab in Visual Studio 2010

余生颓废 提交于 2019-12-10 02:21:39
问题 I want to put an icon in the tab header so that this looks like this. 回答1: You can do it in the VS Designer this way: Add an ImageList to your form. Set the ImageList property of the TabControl to the ImageList which contains the icons. Set the ImageIndex or ImageKey property of each TabPage in the TabControl to the desired image you want to display. If you'd like to do it all in code, here's how to go about it. using System.Drawing; using System.Windows.Forms; public class Form1 { public

How to change the color of the selected tab in the TabControl?

天大地大妈咪最大 提交于 2019-12-09 11:59:35
问题 I am implementing a TabControl for a dialog box in WPF. The color of the selected tab (mouse-down) is white by default. I want to change the color of that selected tab to the color of hover (when I hover over a tab, the color of the tab changes to an Office-blue-gradient, which is what I want the color of the selected tab to be on mouse-click). How can I do that? This piece of code does not work: <Style x:Key="StyleTabControl" TargetType="{x:Type TabItem}"> <Setter Property="Background" Value

WPF TabItem Content alignment is always centered

ⅰ亾dé卋堺 提交于 2019-12-08 16:14:20
问题 I'm trying to put some content inside my TabItem, but I can't add a container that fills the space of the TabItem. Anything that I add shows up centered. I'm using a Theme from WPF Toolkit ( WhistlerBlue.xaml ), so I think that maybe it's that what is causing me this issue. I cannot remove the Theme, because I need it. At most I could change something in it, but I'm new to WPF, and don't know what should I be changing. My TabControl looks like this: <TabControl Margin="0,71.25,0,206.25" Name=

Images are not sharp in selected TabItem

戏子无情 提交于 2019-12-08 15:24:39
问题 I have a TabControl. The header of each TabItem contains a StackPanel with an icon and a Label. <TabControl> <TabItem> <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="/LoginPanel;component/Icons/icoLogin.ico"</Image> <Label VerticalContentAlignment="Center">Login</Label> </StackPanel> </TabItem.Header> </TabItem.Header> <!--some further code here--> <TabItem> <!--some further code here--> <TabControl> Each icon in each non-selected TabItem is displayed as expected. The

WPF Prism Region inside a tab control isn't in the Region List

跟風遠走 提交于 2019-12-08 12:32:58
问题 I've got a tab control with a region attached to it and I've also got a content control inside my tab controls content with another region. The problem I'm having is - if I call RegisterViewWithRegion it adds the view to the region no problem (first time that is, get issues if you swap tabs). But this isn't very flexible and I'm looking for a better way to do that. When I look inside IRegionManager.Regions as well - I can only see the two top level regions. I cant see my sub region

WPF how to create tab items

陌路散爱 提交于 2019-12-08 05:30:18
问题 The number of tab items are not predetermined. I just want to create new tab items and then add new rectangles inside current items. I am generating new tab items(bellow is code) but how can I add rectangles in current tab? var _FloorName = (from fn in db.floors select fn.floorname).ToList(); if (_FloorName.Count > 0) { for (int i = 0; i < _FloorName.Count; i++) { tabControl1.Items.Add(_FloorName[i]); } } 回答1: Here is one approach you could take: Add a Grid (or other container) to each

Silverlight TabItem Visibility not changing

吃可爱长大的小学妹 提交于 2019-12-08 02:58:19
问题 I have a TabControl with many TabItems binding to a ViewModel that has properties for each TabItem's Visibility. <sdk:TabControl> <sdk:TabItem Name="Inventory" Header="Inventory" Style="{StaticResource TabItemStyle}" Visibility="{Binding Permissions.Inventory, Converter={StaticResource PermissiveVisibilityConverter}, ConverterParameter='Viewer'}" DataContext="{Binding VM}" /> </sdk:TabControl> All TabItems are defaulted to a Visibility of collapsed. But when the VM changes a TabItem to

WPF how to create tab items

对着背影说爱祢 提交于 2019-12-07 20:38:30
The number of tab items are not predetermined. I just want to create new tab items and then add new rectangles inside current items. I am generating new tab items(bellow is code) but how can I add rectangles in current tab? var _FloorName = (from fn in db.floors select fn.floorname).ToList(); if (_FloorName.Count > 0) { for (int i = 0; i < _FloorName.Count; i++) { tabControl1.Items.Add(_FloorName[i]); } } Here is one approach you could take: Add a Grid (or other container) to each TabItem when creating them Create a Rectangle , with the brush/dimensions you want Call tabControl1

Change color of unused space of TabControl

时光总嘲笑我的痴心妄想 提交于 2019-12-07 20:12:51
问题 I want to change the color of unused space in the right of TabPage headers. I tried to override the OnPaintBackground method of the window and it is working, this is the code I used: protected override void OnPaintBackground(PaintEventArgs e) { base.OnPaintBackground(e); Rectangle lasttabrect = tabControl1.GetTabRect(tabControl1.TabPages.Count - 1); RectangleF emptyspacerect = new RectangleF( lasttabrect.X + lasttabrect.Width + tabControl1.Left, tabControl1.Top + lasttabrect.Y, tabControl1

How can I switch tabs programatically from within my ViewModel?

做~自己de王妃 提交于 2019-12-07 17:47:06
问题 I have a MVVM desktop application. In my View, I have a TabControl . Any suggestions on the best practice to switch to a specific tab by changing a property on the ViewModel? I suppose it could be done with a SelectedTab property, but then the Tabs have to exist in the ViewModel, and the View must bind to the Tabs list in ViewModel. At the moment, the two tabs are static, in the sence that I won't be creating/deleting any dynamically during execution. So I create the tabs in the View, and