I have WinForm controls I want to put in a WPF DropDownButtons(Extended WPF Toolkit) DropDownContent. Putting the controls to a WindowsFormsHost and that one is giving to the DropDownContent doesn't work.
The Winforms control doesn't visible. In the template the DropDownContent property is a ContentPresenter.
If I want to try this whole story with a common container (StackPanel, Grid, etc.) it works fine.
Does anybody know how can I solve this?
The DropDownButton has a Popup whose AllowsTransparency is set to true - see the template here. You cannot put a WindowsFormsHost into a Popup whose AllowsTransparency is true. You'll have to modify the template for the DropDownButton so that its AllowsTransparency is false.
Related
Normaly KeyboardFocus will be skipped, when the controls IsTabStop property is set to false. But there is no such porperty for the Grid or other Panels. I tried the Attached Property KeybordNavigation.IsTabStop, but this neither had the affect of skipping the Keyboard Focus for the hole grid.
I want to skip all controls within a grid when one of the grid descendant controls will normaly reseive the focus. Has somebody experience with this an can provide an solution?
You were close. On your Grid you need to use the attached property:
KeyboardNavigation.TabNavigation="None"
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.
I have made one custom user control (search text box), which basically consists of one dock panel, and in the panel there are two controls: textbox and button.
I have set some default appearance for this control, which consists of setting a border on the user control, and setting no borders and no background on the textbox, and I have created a custom style for the button. So far this control looks the way I want, and is working correctly.
The problem arises when I want to allow themes for my application. When I put custom styles for basic windows controls (Button, TextBox, ListBox, etc), they are displayed properly with the new theme. But I don't know how to make a template for my custom control. Any attempt ended up in the control not showing at all at runtime.
What exactly must be done in the new template for this control? Do I need to make a template for the User control, and for the textbox and the button controls also?
You are mixing up user controls and custom controls here. What you described above is a user control, and you cannot apply new templates to it.
Are there any default exceptions where wpf controls are not focusable?
My controls need to be all focusable, but I do not want to set everytime I create a control
make focusable="true"
In general, WPF controls work as expected with regards to being focusable or not. Things you can interact with such as button, list/items controls, textbox are all focusable. Non-interactive controls like TextBlock, Image are non-focusable. So normally, you don't have to deal with setting the value of the Focusable property. I'm not sure if this is what you're looking for but I hope this helps.
I would like to change the color of the popup background when using a DatagridComboboxColumn in the WPF Toolkit datagrid. I've edited the Template for a normal Combobox and it works great for selected item and other properties but the background stays white. I've used Snoop to do some research into the template and it claims that the DropdownBorder's background is set by the parent template but I can't figure out which template that is.
Any ideas?
You have to change ItemContainerStyle, that contains style and template to control background/selected color etc. Because ItemContainerStyle of ListBox and ComboBox has IsSelected property that can be used for setting trigger for changing background color.