tabcontrol

How do you modify a control that has been re-parented to a TabPage?

こ雲淡風輕ζ 提交于 2019-12-12 23:08:39
问题 I have a user control that contains a collection of controls to be reused for presenting data on the UI. I've attempted implementing a "pop-out" option that will re-parent the control from another container on the form (a Panel, for example), create a new tab page, and then add the control to the tab page. Unfortunately, when the control is added to the TabPage, its size appears to be locked to the way it was presented with the last parent. I overrode the ParentChanged event to detect when

ListBox not highlighting selection on tab change

老子叫甜甜 提交于 2019-12-12 21:33:34
问题 I'm currently trying out C# and WPF for the first time. I have a window with two tabs, tabA and tabB . Each tab has a list box (they are almost identical), tabA has listboxA and tabB has listboxB . When an item in a list box is selected, some information about the item is shown, so that I know that it is selected. On a certain event E , I want an item in listboxA or listboxB to be highlighted and selected, which one is determined by the logic in my application. Scenario A is that I am

Dragging over a tab to bring to front

♀尐吖头ヾ 提交于 2019-12-12 20:02:54
问题 I'm dragging data from outside my application onto a TabControl. I'd like to be able to drag over a "tab" and have that tab brought to the front. The drag events on the TabControl and the TabItems only seem to fire for the active tab, and only fire when dragging over the tab content, not the "tab" itself. The markup for the control is: <Window x:Class="DragOverTabExample.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx

WPF: TabControl and dynamic TabItems

落花浮王杯 提交于 2019-12-12 12:22:59
问题 I am trying to create a GUI for my current project using WPF in C#. I would like to have tabs (dynamically created at runtime) and each tab should open a table with the same column headers but different contents. I know I could realize tabs and tables like this: <Grid> <TabControl x:Name="tabControl" TabStripPlacement="Left"> <TabItem Header="Example 1" x:Name="tabItem" > <DataGrid ItemsSource="{Binding TagCollection.Tags}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn

WPF - TabControl - Prevent Selection Change

女生的网名这么多〃 提交于 2019-12-12 09:43:48
问题 It seems that the WPF TabControl doesn't support the ability to cancel a selection change, since there is no SelectionChanging() event, only a SelectionChanged event. Has anyone figured out a way to do this? The only way I have found is to attach to the PreviewMouseLeftButtonDown() event on each TabItem and set e.Handled to true if I don't want that particular page selected. This seems to work but is clunky. 回答1: I found a way do do this using a style for a TabItem and then binding the

WPF Tab Control: How do I get the currently selected tab?

走远了吗. 提交于 2019-12-12 09:29:14
问题 In my tab SelectionChanged event (is this the correct event, I can't find a tab changed event?), how do I access the new tab? Also from outside this event in normal code, how do I access the currently selected tab? TabControl.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(TabControl_SelectionChanged); void TabControl_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { //How so access my currently selected tab??? } 回答1:

How to access controls that are inside a TabControl tab?

僤鯓⒐⒋嵵緔 提交于 2019-12-12 08:46:20
问题 This is all I have so far. tabControl1.TabPages[0].??? I have a PictureBox inside of TabPage1 of my TabControl. How can I change the image location with code and not the properties pane? 回答1: Although the controls appear inside a container (as a TabControl), they're all defined on the form, so there is no need to access them through the container. Instead of: tablControl1.TabPages[0].MyContainedControl... Simply type: MyContainedControl... 回答2: Unless you've set GenerateMember to false on the

Binding for TabItem's content controls

可紊 提交于 2019-12-12 06:01:24
问题 I have a TabControl with ItemsSource set to ObservableCollection<BookTab> and using ContentTemplateSelector to create different tabs. class BookTab { public string Name { get; set; } public string Type { get; set; } public object Data { get; set; } } <TabControl Name="tabControl" ContentTemplateSelector="{StaticResource tabTemplateSelector}"> <TabControl.ItemContainerStyle> <Style TargetType="TabItem"> <Setter Property="Header" Value="{Binding Name}"/> <Setter Property="Content" Value="

How to get a TabControl to resize with other members inside of it

泄露秘密 提交于 2019-12-12 05:58:26
问题 I know that TabControl is not an item that automatically resizes, and that you can anchor it to a side and then set it to stretch and that may fix the problem, but are there any other ways to get the TabControl to expand to fullscreen when application is maximized? while also having all the properties expand and stay proportionate as well. And can this be done in the XAML rather than the code behind as I created everything within the XAML? Bellow is a snip of the code for the MainWindow of

Use deserialized XML data in TabController + DataGrid

半腔热情 提交于 2019-12-12 05:48:22
问题 After this: Acess to a DataGrid through C# code and manipulate data inside the DataGrid I decided that i should deserialize my XML data and use it that way because i need basic CRUD manipulation in my application. I already have my xml data class (using XSD tool, you can find the class here -> http://pastebin.com/6GWFAem6) and have my data deserialized, problem is: I need a TabControl with as many tabs as Semestre in my xml, each tab will have GPASemestre.Nome header. Inside each tab i need a