tabcontrol

Issue with WPF validation(IDataErrorInfo) and tab focusing

最后都变了- 提交于 2019-11-28 21:33:57
I have a TextBox bound to a property of an object which implements IDataErrorInfo . I set up the Validation.ErrorTemplate of the TextBox , and it works fine. The problem is that I have these on a TabControl , and the validation template doesn't display any more if I change the tab to another one and then come back to the initial tab (where the TextBox is). It looks like it is validated(like the value is correct), but actually it is not. This is the IDataErrorInfo object - note that a "correct" value is a string with a length of 2: public class Presenter : IDataErrorInfo { public Presenter() {

Vertical Tab Control with horizontal text in Winforms

蓝咒 提交于 2019-11-28 21:27:06
I would like to have the tabs on my TabControl displayed on the left, or sometimes right. Unlike the System.Windows.Forms.TabControl, however, I would like the text to remain horizontal instead of being rotated by 90 or 270 degrees to the horizontal. Here are a couple of pictures illustrating the concept Though I could write code to do this myself in about an hour or two, I just thought I'd ask first if there is any existing Winforms control that implements such feature. NB: Any existing solution should preferably be non-commercial. Thanks. I don't know how robust this is and I can't claim to

Check if a specific tab page is selected (active)

*爱你&永不变心* 提交于 2019-11-28 21:01:02
I am making an event to check if specific tab page in a tab control is active. The point is, it will trigger an event if that tab page in a tab control is the currently selected tab. Any code that will give me what I need? Assuming you are looking out in Winform, there is a SelectedIndexChanged event for the tab Now in it you could check for your specific tab and proceed with the logic private void tab1_SelectedIndexChanged(object sender, EventArgs e) { if (tab1.SelectedTab == tab1.TabPages["tabname"])//your specific tabname { // your stuff } } To check if a specific tab page is the currently

How to build vertical tab sets in WPF?

痴心易碎 提交于 2019-11-28 20:03:47
How to build vertical tab sets in WPF? The tabs will stack up in top-to-bottom just like the "Properties" of a project shown in visual studio. Have you tried the TabControl.TabStripPlacement Property ? The following example creates a tab control that positions the tabs on the left side. <TabControl TabStripPlacement="Left" Margin="0, 0, 0, 10"> <TabItem Name="fontweight" Header="FontWeight"> <TabItem.Content> <TextBlock TextWrapping="WrapWithOverflow"> FontWeight property information goes here. </TextBlock> </TabItem.Content> </TabItem> <TabItem Name="fontsize" Header="FontSize"> <TabItem

WPF Error Styles only being rendered properly on visible tab of a tab control

我是研究僧i 提交于 2019-11-28 17:42:57
问题 I have a data object used to contain my UI data that supports INotifyPropertyChanged and IDataErrorInfo . Originally I had all of the UI controls displaying in one big WPF application and was happily seeing errors flagged via this custom style: <!-- Set error style for textboxes --> <Style x:Key="txtBoxErrStyle" TargetType="{x:Type TextBox}"> <Style.Triggers> <Trigger Property="Validation.HasError" Value="True"> <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static

How to add and remove “custom” tabs in C#

爷,独闯天下 提交于 2019-11-28 13:11:39
I am making an application that requires tabs (tab-control) to be added or removed. I have done the add and remove for tabs fine, but I have custom buttons instead of using the tabs. (This button will go the the first tab page when clicked): //This will make it go to TAB 1 private void button1_Click(object sender, EventArgs e) { tabControl1.SelectedIndex = 0; } //This will change the MOUSEENTER to the correct image private void button1_MouseEnter(object sender, EventArgs e) { button1.MouseEnter += new EventHandler(button1_MouseEnter); this.button1.BackgroundImage = ((System.Drawing.Image)

ListBox in TabControl scrolling issue

孤者浪人 提交于 2019-11-28 12:50:22
I have an issue with WPF ListBox in TabControl. ListBox resets it's scrollbar position to 0 when I change tabs. Here is repro code: <TabControl x:Name="_tabs"> <TabItem Header="1"> <ListBox ItemsSource="{Binding}" ScrollViewer.VerticalScrollBarVisibility="Auto"/> </TabItem> <TabItem Header="2"> <ListBox ItemsSource="{Binding}" ScrollViewer.VerticalScrollBarVisibility="Auto"/> </TabItem> </TabControl> _tabs.DataContext = Enumerable.Range(1, 300).ToArray(); When the window opens I open the second tab, scroll list somewhere to the middle, return to the first tab and then open the second again.

Embed a form onto a tabcontrol in windows forms

十年热恋 提交于 2019-11-28 12:13:13
I have a tab control in a windows form and I want to be able to click on a tab and in the body area of the tab I want it to display another form as an embedded component. Is this possible? If so, can someone please provide an example or a link to an example of how to accomplish this? You are probably looking for Tabbed MDI Child Forms You can embed a Form but it's not the best choice. Better place the contents on UserControls and add that to the TabPage. Set your MainForm (Parent) as IsMDIContainer = true; Create an instance of the ChildForm and call this function: FormChild frmChild = new

Using a datatemplate for the TabItems in a tabControl

本小妞迷上赌 提交于 2019-11-28 11:52:41
问题 If I have a class called: GuiObject, and that class has a list of GuiObjects called: "GuiObjects". Now say my window has a list of GuiObjects, which I use in the .xaml file to dataBind to: <StackPanel> <ItemsControl ItemsSource="{Binding TopObjectList}" DataTemplateSelector="{DynamicResource templateSelector"/> </StackPanel> I can make a datatemplate for every type of FrameworkElement I want to generate, but I'm having trouble with the TabControl. I can create a datatemplate for the

Strange issue with a datagridview and a tabcontrol C#

柔情痞子 提交于 2019-11-28 11:49:20
I have a strange problem. I have a TabControl with two TabPages . Each page has a datagridview . Both datagridviews are populated with XML files. I want to have the AutoSizeColumnsMode set to " Fill " for both DataGridViews . I want to set the width of columns in my code. And everything works fine for the TabPage1 but setting width for the DataGridView on TabPage2 throws the NullReferenceException . I really don't get it because I do the same thing as for datagridview1 and there works fine but datagridview2 throws the exception. Additionally, there is no exception if I choose any