tabcontrol

Selecting TabItem in TabControl from ViewModel

浪子不回头ぞ 提交于 2019-12-24 11:03:10
问题 I have been struggling with this for a day or so, can't figure out what I'm doing wrong here. I want to be able to select any tab in my observable collection of tabs, and I want my selection to be visible in the UI. I have tried SelectedIndex and SelectedItem. I can see that my Properties are set but my tabs are not selected, nothing happens in the UI. Here is my code: MainWindow.xaml <Window x:Class="WpfApplication5.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation

Close dynamically added Tab Items using Prism - WPF

两盒软妹~` 提交于 2019-12-24 09:53:10
问题 I'm using Prism RegionManager , to register different views with a TabControl region inside the MainView . MainView.xaml <TabControl regions:RegionManager.RegionName="MainViewTabRegion"> <TabControl.ItemTemplate> <DataTemplate> <DockPanel Width="Auto"> <Button Command="{Binding DataContext.DataContext.CloseTabCommand, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}" Content="X" Cursor=

MVVM Binding Views to TabControlItems - Views don't display

孤街浪徒 提交于 2019-12-24 07:48:43
问题 I want to display different views in TabControlItems in my MainView. To do this I've created a class like this : public sealed class TabItem { public string Header { get; set; } public ViewModelBase Content { get; set; } } That I call in a List in my ViewModel : private ObservableCollection<TabItem> _views; public ObservableCollection<TabItem> Views { get { return _views; } set { _views = value; RaisePropertyChanged(() => Views); } } public IndexMainViewModel() { Views = new

Flutter DefaultTabController unexpectedly initializing widget during animation when navigating from tab 0 to tab 2

北战南征 提交于 2019-12-24 07:13:43
问题 I am using a DefaultTabController to manage 3 tabs. The default tab controller is set up like this: DefaultTabController( length: 3, initialIndex: 1, child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ Material( type: MaterialType.canvas, elevation: 1.0, child: Container( color: Color(0xFFe3f2fd), child: TabBar(tabs: [Tab(text: 'ACTIVITY'), Tab(text: 'LEADERBOARD',) ,Tab(text: 'SETTINGS',) ], labelColor: Theme.of(context).primaryColor, indicatorColor: Theme.of(context)

WPF TabItem - Image Binding

半城伤御伤魂 提交于 2019-12-24 01:57:14
问题 Issue I am trying to bind an Image from my TabItem to my TabControlResource section but I cannot seem to do this. The Header text is fine as the TabItem has a Header attribute but there is nothing I can add my image to. Code Here is the whole of my TabControl code: <TabControl Margin="10" BorderBrush="#c83620" BorderThickness="4" Background="#e37e6e" FontFamily="Segoe UI" FontSize="14" > <TabControl.Resources> <Style TargetType="TabItem"> <Setter Property="Template"> <Setter.Value>

How to disable tab wrapping in the Tab Control object

一笑奈何 提交于 2019-12-24 00:23:06
问题 I'm designing a GUI in WPF/C# and I'm using the Tab Control object. My tab control will contain a lot of tabs, and I would like to know how to disable the default "wrapping" behavior of the object. Basically the opposite of this question. How would I go about doing that? Thank you. 回答1: Just change the ItemsPanel : <TabControl ....> <TabControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> </TabControl.ItemsPanel> .... </TabControl> Edit: Just

c# mvvm bind views to tabcontrol with header

对着背影说爱祢 提交于 2019-12-23 15:55:02
问题 I have a wpf programme with a main View ( Window )which contains a TabControl to show several different UserControl Views (the sub-views , one in each tab). Every View has an associated ViewModel. I wish to bind the TabControl so that I just need to load a new sub-view into the ApplicationViewModel and it will appear on the TabControl . I have successfully bound the sub-views to the content, but cannot seem to get anything in the header. I wish to bind the header to a property in the sub-view

.NET : Double-click event in TabControl

时光毁灭记忆、已成空白 提交于 2019-12-23 10:24:14
问题 I would like to intercept the event in a .NET Windows Forms TabControl when the user has changed tab by double-clicking the tab (instead of just single-clicking it). Do you have any idea of how I can do that? 回答1: The MouseDoubleClick event of the TabControl seems to respond just fine to double-clicking. The only additional step I would do is set a short timer after the TabIndexChanged event to track that a new tab has been selected and ignore any double-clicks that happen outside the timer.

C# Winforms TabControl elements reading as empty until TabPage selected

给你一囗甜甜゛ 提交于 2019-12-22 23:25:15
问题 I have Winform app I am writing in C#. On my form, I have a TabControl with seven pages, each full of elements (TextBoxes and DropDownLists, primarily). I pull some information in with a DataReader, populate a DataTable, and use the elements' DataBindings.Add method to fill those elements with the current values. The user is able to enter data into these elements, press "Save", and I then set the parameters of an UPDATE query using the elements' Text fields. For instance: updateCommand

WPF Tab Control With No Tabs

淺唱寂寞╮ 提交于 2019-12-22 18:48:09
问题 I would like to have a control similar to tab control but without the "TabStrip" part and have the tabs be changed by a combo box instead. how to I make this happen? I guess that the answer is out there I just fail to correctly phrase it in English. 回答1: Don't use a tabcontrol for this. Use a ContentControl where you dynamically bind the content. <ContentControl Content="{Bindning MyDynamicContent}" /> The change the item that is stored in the MyDynamicContent property based on the checkboxes