tabcontrol

Problem With Alignment of Image on TabControl

泪湿孤枕 提交于 2019-12-11 03:12:58
问题 I'm using a c# winform TabControl . I've created an ImageList , associated it with the TabControl and populated it with a few images. The problem is, when I set the ImageIndex or ImageKey for a particular tab the image shows up on the tab, but it covers the text that is on the tab. To add to my confusion, one TabPage in particular renders the image in the correct location (image followed by text). The page that has the image in the correct location is whatever TabPage I set the ImageIndex

add a tab programically, c# tab control

本秂侑毒 提交于 2019-12-11 02:53:10
问题 hi everybody i want to ask : How to add a tab programmically. for my problem i have a tab control, as default only one tab. and i have a button when i click that button will add one other tab. so will be two tab. please help me using c# and xaml. 回答1: tabControl.Items.Add(yourNewTabItem); 回答2: Try this way: tabControl1.TabPages.Add("tab 3"); 回答3: Some more code to create and modify tabPages manually: public partial class Form1 : Form { TabControl tc; public Form1() { InitializeComponent(); tc

WPF: binding several views to a TabControl's items

自作多情 提交于 2019-12-11 02:47:58
问题 In the current project we work on, we have a main window with several views (each with its own viewmodel) that are presented as items in a tab control. E.g: One tab item is an editor, and contains the editor view as follows: <TabItem Header="Test Editor"> <TestEditor:TestEditorView DataContext="{Binding TestEditorViewModel}"/> </TabItem> Another one shows results: <TabItem Header="Results Viewer"> <ResultViewer:ResultViewer x:Name="resultViewer1" DataContext="{Binding Path=ResultViewModel}" /

How to find control from datatemplate of tabitem wpf

淺唱寂寞╮ 提交于 2019-12-11 01:48:47
问题 I have TabControl: <TabControl Name="tabControl" VerticalAlignment="Top" HorizontalAlignment="Stretch"> <TabControl.Items> <TabItem x:Name="tab1" Header="ABC"> <TabItem.ContentTemplate> <DataTemplate> <ScrollViewer Name="ScrollViewer"> <StackPanel Orientation="Vertical"> <TextBox Name="txt1" HorizontalAlignment="Center" Margin="0,26,0,0" /> <ListBox Name="listBox" DataContext="{Binding Items, Mode=TwoWay}" /> </StackPanel> </ScrollViewer> </DataTemplate> </TabItem.ContentTemplate> </TabItem>

Trying find how to cancel TabControl.SelectionChanged in silverlight

雨燕双飞 提交于 2019-12-11 01:12:53
问题 I am trying figure out how cancel this event in silverlight, sadly i didn't find any useful link with the solution :( (i saw some post for wpf wich i think are not longer available for silverlight) 回答1: Here is the bare bones of it:- bool cancellingTabSelectionChange = false; private void tabControl1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.RemovedItems.Count > 0 && !cancellingTabSelectionChange) { cancellingTabSelectionChange = true; ((TabControl)sender)

WPF - two rows of tabs in a tab control - tab wrap

大兔子大兔子 提交于 2019-12-11 01:01:51
问题 I have a WPF TabControl with a large number of tabs and they are presented in a sequential line all across the screen. Which means that a user needs to scroll sideways in order to view all the tabs. Is there a way to create two rows of tabs or make the long row of tabs "wrap" into two or more rows? 回答1: Wrapping is the default behavior for TabControl s. Any Style or ControlTemplate you're using that interferes with that? The following code: <Window x:Class="WpfApplication1.Window1" xmlns=

displaying multiple datatable in tabcontrol C#

回眸只為那壹抹淺笑 提交于 2019-12-10 23:36:50
问题 i have a small program that takes a datatable (takes data from sql database) then splits it into datatable array by field and then should display it in a tabcontrol, each field in it's own tab the split, takes single datatable and splits into datatable array, works fine i think public DataTable[] splitTable(DataTable mainDT,string columnName) { int tmp=0; DataTable[] splitDT = new DataTable[11]; for (int i=0;i<11;i++) splitDT[i]=new DataTable(); foreach (DataRow row in mainDT.Rows) { tmp =

Adding a Design time Panel to a TabPage at run time

本秂侑毒 提交于 2019-12-10 23:35:18
问题 I wish to have a Panel with the controls on it at design time but I want to add this panel to a desired tabPage of my TabControl at run time. I wrote something like this, did not work : the panel does not show up in the tab page. please help me. panel2.Parent = tabGuy.TabPages[0]; tabGuy.SuspendLayout(); tabGuy.TabPages[0].Controls.Add(panel2); tabGuy.ResumeLayout(); panel2.Show(); 回答1: You probably need to set the coordinates of the Panel as well, or (better) panel2.Dock = DockStyle.Fill;

WPF/C#: How does one reference TabItems inside a TabControl?

孤者浪人 提交于 2019-12-10 20:24:01
问题 I'm sure there is something simple that I am missing, but I must confess that at this point I am at a loss. I am programmatically adding TabItems to my main TabControl, one for each account that the user chooses to open. Before creating and adding a new TabItem I would like to check if the user already has the account open in another tab. I do not want to end up with two identical tabs open. Here is the code that I originally wrote. Hopefully it gives you an idea of what I am trying to

Can I have multiple instances of the same UserControl in 1 app?

廉价感情. 提交于 2019-12-10 20:05:53
问题 I am creating a Text Editor Type app. I can have multiple editors open via tabs. In my first try, I used simple TextBox es to edit text. Everything worked ok. Then I created a UserControl encapsulating the text box + buttons to perform text manipulation eg. bold/italic etc. I found out that when I open different tabs, they all contain the same content. eg. In Tab1 i enter "hello world" that will appear in all tabs. There is "no separation" even though they are in different tabs <Window