tabcontrol

WPF Routed Command with Bindings per-Tab

拜拜、爱过 提交于 2019-12-01 10:09:27
问题 I intended to disable and enable the Buttons outside the TabControl, just like those inside the TabItem when the current tab is changed. But the CommandBindings of the TabItem do not seem to impact "up" the visual tree. What is the right way to do this? With this XAML: <Window x:Class="WpfApplication10.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication10" Title=

Getting parent of new tab after adding to bound TabControl (mvvm)

孤人 提交于 2019-12-01 09:21:41
I'm adding a close button to my tabs using the following guide: http://www.codeproject.com/Articles/84213/How-to-add-a-Close-button-to-a-WPF-TabItem This has become a problem because the event uses the 'parent' of the added tab to remove that tab from the tabcontrol. I'm binding the tab control using mvvm, so the parent property is apparently not being set and giving me a null reference exception for the parent when the event tries to remove from it. Here's the binding so you get the idea: <TabControl Name="tabControl" Margin="0,22,0.2,-5.2" ItemsSource="{Binding Tabs}" Background="#FF4C76B2"/

How do I make a TabPage's title text bold?

放肆的年华 提交于 2019-12-01 06:02:55
I have some tabControl in C# Windows app. It has some tabPages. Does anyone kwows how to make the tabPage Text to become Bold..? vts123 You'll need to handle the DrawItem event of the TabControl to manually draw the caption. Note: DrawMode of affected control should be set to TabDrawMode.OwnerDrawFixed . Here is a sample: private void tabControl1_DrawItem(object sender, DrawItemEventArgs e) { Graphics g = e.Graphics; Brush _TextBrush; // Get the item from the collection. TabPage _TabPage = tabControl1.TabPages[e.Index]; // Get the real bounds for the tab rectangle. Rectangle _TabBounds =

How can i make WinForms TabPage header width fit it's title?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 05:39:20
How can i make WinForms TabPage header width fit it's title? Here is the problem. The native Windows tab control allows overriding the default minimum tab width. Sadly that capability is not exposed in the TabControl wrapper class. That's fixable though. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form. using System; using System.Windows.Forms; class MyTabControl : TabControl { protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); // Send TCM_SETMINTABWIDTH SendMessage(this.Handle,

How to get current tab index in Flutter

时间秒杀一切 提交于 2019-12-01 04:12:46
In flutter implementing a tab layout is easy and straightforward. This is a simple example from the official documentation : import 'package:flutter/material.dart'; void main() { runApp(new TabBarDemo()); } class TabBarDemo extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( home: new DefaultTabController( length: 3, child: new Scaffold( appBar: new AppBar( bottom: new TabBar( tabs: [ new Tab(icon: new Icon(Icons.directions_car)), new Tab(icon: new Icon(Icons.directions_transit)), new Tab(icon: new Icon(Icons.directions_bike)), ], ), title: new Text

How do I make a TabPage's title text bold?

佐手、 提交于 2019-12-01 03:42:44
问题 I have some tabControl in C# Windows app. It has some tabPages. Does anyone kwows how to make the tabPage Text to become Bold..? 回答1: You'll need to handle the DrawItem event of the TabControl to manually draw the caption. Note: DrawMode of affected control should be set to TabDrawMode.OwnerDrawFixed . Here is a sample: private void tabControl1_DrawItem(object sender, DrawItemEventArgs e) { Graphics g = e.Graphics; Brush _TextBrush; // Get the item from the collection. TabPage _TabPage =

How to design a TabPage when the TabControl's ItemsSource is Bind to a List in WPF?

爷,独闯天下 提交于 2019-12-01 02:36:15
问题 These are my Classes: class mainViewModel { public List<Foo> F { get; set; } public mainViewModel() { F=new List<Foo>() { new Foo(new Animal(){Name = "Cat"}), new Foo(new Animal(){Name = "Dog"}), new Foo(new Animal(){Name = "Camel"}) }; } } public class Foo { public Animal Animal { get; set; } public Foo(Animal animal) { Animal = animal; } } public class Animal { public string Name { get; set; } } And This is my MainWindow Xaml Code: <TabControl ItemsSource="{Binding Path=F}"> <TabControl

Can Firemonkey TTabControl replicate VCL TPageControl.OnChanging event?

冷暖自知 提交于 2019-11-30 21:18:50
问题 I'm Running Delphi Dx Seattle In Delphi VCL's TPageControl there is a onChanging event where you could stop the page control from changing tab's procedure TForm1.pgc1Changing(Sender: TObject; var AllowChange: Boolean); begin if MessageDlg('do you want to change tab?', mtConfirmation, [mbyes, mbno], 0, mbNo) = mrno then AllowChange := false; end; Is there a way for Delphi Firemonkey TTabControl to replicate this? e.g. if you have two tabs and clicking on the other tab pops up a question 'do

WPF preserve Tab control state

a 夏天 提交于 2019-11-30 17:02:21
I have read the posts @ How to stop Wpf Tabcontrol to unload Visual tree on Tab change , but I could not get it work, I must have missed something. Pls help. thanks I am using class TabControlEx from sample project @ http://www.pluralsight-training.net/community/blogs/eburke/archive/2009/04/30/keeping-the-wpf-tab-control-from-destroying-its-children.aspx <Window x:Class="MyMainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sharedC="clr-namespace:myShared.Converter;assembly=myShared" xmlns:mainTab="clr

Make TabControl Headers Scrollable in WPF

泄露秘密 提交于 2019-11-30 15:37:25
As Mentioned in Title, I want to change the header of my TabControl to be scrollable. The reason: I have too many tabItems, and the wrapping is not the best solution in my case. so I want to change it from : To something like that (Scroll bar indicated by the arrow) : Can anyone help me and show how to do that ? (I'm using wpf) Changing TabControl.Template to something simple like this seems to work for me <TabControl ...> <TabControl.Template> <ControlTemplate TargetType="{x:Type TabControl}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition/> </Grid.RowDefinitions>