mouse click event on Tab header in Tabcontrol - wpf

I have my TabControl made in WPF with C#. But I display the window like a bar by using window position. I mean while displaying only tabheader will be display. My tab header are in the left side. When I press the tabheader the window width will increse to fit the tab items content.
So I want the click event of tab headers in tabcontrol. How can I get that?

Two options:
Set the window to auto size to it's content using the Window property: SizeToContent
Use the TabControl event: SelectionChanged

Related

Telerik WPF controls: what control can host multiple controls inside a pane

I've split the window into left and right panes using the docking splitter, panegroups, and panes. Each pane must host several controls:
LEFT PANE
FileDialog
ProgressBar
GridView
RIGHTPANE
checkbox + label
dropdown list
another dropdown list
button
GridView
another button
Multiple controls cannot be added directly to the pane. What (Telerik) container control should be placed in each of the panes to host their respective controls?
Arrange the controls in the pane using any of the standard panel controls (Grid, StackPanel, Canvas, DockPanel etc).

WPF TabControl - In need of a default message before tabs load

I have a WPF TabControl who's TabItems are MEF'd in at run time. However, they are MEF'd in only when a certain item in a left-hand treeview is selected. What I'd like to do is display a centered message inside the TabControl indicating "No Active Scenario Selected". I tried adding a TextBlock inside the TabControl but what I got was a TabItem instead. Any ideas?
One way to do this is simply by putting a TextBlock on top of the TabControl and show it when the TabControl doesn't have any Tabs added.
You can bind the Visibility of the TextBlock to the HasItems property of the TabControl and use a value converter (BooleanToVisibilityConverter or your own implementation) to show and hide the TextBlock.

TextBlock over a listview: how to ignore clicks in the TextBlock and let the listview handle them

I have a listview which displays a lot of info, but when it's empty I want to overlay a textblock over it which says "No Info to Display" or "Do bla-bla-bla to add info".
The listview is set up to respond to mouse clicks, but now if I click on the textblock, those events are routed to the textblock. How can I make these events go to the listview instead?
IsHitTestVisible= "false" on the TextBlock.

How to adjust the height of the window dynamically in WPF?

I have a model window that contains expander control.
This expander control when expanded shows the user control which allow user to enter input through textboxes.
When expander control is collapsed it hides the user control.
I want when expander is collapsed or expanded the window will resize its height accordingly at run time.
Pleas help!!
You can set property SizeToContent="WidthAndHeight", see also on SizeToContent on MSDN

Showing a tooltip on a combobox from the itemtemplate (WPF)

I have a ComboBox with a DataTemplate. The DataTemplate has two controls, each of which has a ToolTip attached to it. The list of items of the ComboBox has the tooltips as expected when you hover over each control. But the selected item area on top of the ComboBox does not display the tooltips, though the controls are rendered as expected. Is there a way to force the tooltips to be displayed?
If you're using Mole or something similar, make sure that your control with the attached ToolTIp has IsHitTestVisible="True". Otherwise, the control is not listening for mouse events and will not recognize that the ToolTip should be shown in the first place.
You may also want to look at binding the ToolTip of the selected item to the ContentPresenter in the ComboBox since, after selection, your SelectedItem becomes the content of the ComboBox. You may need to override the ComboBox template and make sure the ContentPresenter can accept mouse input in order to force your ToolTip's visibility.

Resources