tabcontrol

How to style a TabControl's TabItem without styling their ContentPresenters?

喜你入骨 提交于 2019-12-12 05:28:25
问题 I have a TabControl, and I apply a style to it in order for my TabItems' header to have no background nor border. My problem is that if I add a trigger for the selected one, the corresponding panel get styled as well. So if I choose to set the selected TabItem's foreground to Red, the panel's textblocks become red as well. Fun fact: it doesn't apply to Labels. I'm quite lost. Here's the XAML, that tests pretty fast in Kaxaml: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml

C# Winforms Panel with same style (shadow) as TabControl?

泪湿孤枕 提交于 2019-12-12 04:53:33
问题 I want a panel to have some sort of dropshadow like the TabControl has, is this possible? 回答1: BorderStyle = Fixed3D take a look for the shadow in this example: http://www.onteorasoftware.com/downloads/panelwithshadow.zip Finally, the custom panel could be like (in VB): Imports System.Drawing.Drawing2D Public Class ShadowPanel Inherits Panel Declare Function GetWindowDC Lib "user32" Alias "GetWindowDC" (ByVal hwnd As IntPtr) _ As IntPtr Declare Function ReleaseDC Lib "user32" Alias "ReleaseDC

Set focus to a button in a new TabItem

拈花ヽ惹草 提交于 2019-12-12 04:36:00
问题 I use a TabControl to display a list of items. The ItemView is a separate control I wrote. <TabControl SelectedItem="{Binding CurrentItem}" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding ItemList}"> <TabControl.ContentTemplate> <DataTemplate> <ctrls:ItemView/> </DataTemplate> </TabControl.ContentTemplate> <TabControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding ShortItemDescription}"/> </DataTemplate> </TabControl.ItemTemplate> </TabControl> If the user presses a Button

How to find the current/active Tab in Josh Smith's MVVM Demo App

泪湿孤枕 提交于 2019-12-12 04:25:23
问题 I've been adapting Josh Smith's MVVM Demo app to suit my requirements. I have been successful for most part of it. Now I want to add a feature "Print"(similar to a print feature that exsits in any application) in the file menu item for this applicaiton. Since I can open multiple tabs in this application, how will I know which tab(to be more specific which Workspace) was active when the user clicked the "Print"? The code below shows the DataTemplate where the TabControl is used in the DemoApp.

Windows Forms C# TabControl ImageList Alignment?

瘦欲@ 提交于 2019-12-12 04:04:23
问题 Is it possible to align the image icon from on a TabControl's ImageList to the right of the text? Right now, the image icon gets put on the left, and the text is to the right of that. I would prefer the text to be on the left, and the icon to the right of that. Is this possible? 回答1: You can not do that unless you Draw the TabPage yourself. To do that you need to set the DrawMode property of the TabControl to OwnerDrawFixed and then handle the DrawItem Event. This is a very simple example to

How can I conditionally hide the TabPanel portion of a TabControl in its entirety?

牧云@^-^@ 提交于 2019-12-12 04:03:24
问题 I've found a lot of variations of this question, but the conversation always seems to revolve around the individual TabItems , and not the TabPanel as a thing unto itself. My main window has a TabControl on it. The tabs are views. One of those views is special...a navigation display, whereas all of the others are the "sections" that the nav view can open. What I am trying to accomplish is that when the user is viewing the nav view, the tabs all go away. I.e. hide the whole TabPanel instead of

Keeping graphics unaltered when TabPage changes

人走茶凉 提交于 2019-12-12 03:33:24
问题 I have a form that displays a set of graphics using a Paint event on a Panel that is docked inside a particular TabPage of a TabControl . The problem is the following: When the user switches to a different TabPage and then decides to go back to the TabPage where the graphics were originally displayed, those graphics are invalidated by default so the Panel appears blank. I would like those graphics to stay unaltered and totally independent from the user's action when switching between

WPF MVVM: Strange Binding behavior

北慕城南 提交于 2019-12-12 03:28:10
问题 I have a UserControl that contains a TabControl . <UserControl x:Class="Test.MyUC" .... xmlns:vm="clr-namespace:Test.ViewModels" xmlns:ikriv="clr-namespace:IKriv.Windows.Controls.Behaviors" ... <UserControl.Resources> <vm:MyUCVM x:Key="VM" /> </UserControl.Resources> <UserControl.DataContext> <StaticResourceExtension ResourceKey="VM" /> </UserControl.DataContext> <!-- Using Ivan Krivyakov's Attached Behavior --> <TabControl ikriv:TabContent.IsCached="True" TabStripPlacement="Top" ItemsSource=

ItemContainerStyle of TabItem is overriden by defalt Blue/white control colors in WPF Tabcontrol

对着背影说爱祢 提交于 2019-12-12 02:47:07
问题 i have a Tabcontrol with Datatemplate for its TabItems and a ItemContainerStyle for the style of the TabItem. The TabControl: <TabControl Name="MainTabCtrl" Margin="0" Padding="0" BorderThickness="0" Background="Transparent" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=TabViewModels}" ItemTemplate="{StaticResource ClosableTabItemTemplate}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" ItemContainerStyle="{StaticResource ContainerStyle}"> The

Tab Page Header Location

大兔子大兔子 提交于 2019-12-12 02:27:00
问题 I have a Tab Control in my Form and what I want to achieve is a simple way to get the exact location the Tab Page Header. I've searched around, but I haven't found anything. Any ideas? 回答1: This will make the Tab control blink a little but it will return a list of bounding Rectangles for the pages' headers.. SortedDictionary<int, Rectangle> GetTabBounds(TabControl tab) { SortedDictionary<int, Rectangle> bounds = new SortedDictionary<int, Rectangle>(); TabDrawMode tdm = tab.DrawMode;