Are all WPF controls FOCUSable? - wpf

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.

Related

Skip KeyboardNavigation for all Controls in a Panel or Grid in WPF

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"

Locking controls on the canvas in a form editor in WPF

I am building a form editor in WPF. One of the features we need in it is to let the user "lock" one or more controls on the canvas. By locking I mean the user would not be able to move, resize or modify other properties of the control.
I have tried with ContentControl but did not get the results I am looking for.
I think you should use the IsEnabled property. Basic controls with interaction have this, and you can expose it on your custom controls as well and pass the property down.
If something is set with IsEnabled = false it will be grayed out and cannot be affected by user input.

WindowsFormsHost content doesn't show when its given to a ContentPresenter

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.

Writable ComboBox in Silverlight

How can we change a Silverlight ComboBox writable like in Windows Form when we change the DropDown property.
I believe the closest you can get is autocompletebox
ComboBox in Silverlight does not have IsReadonly and IsEditable properties like WPF that allow it to be editable.
You will have to create a custom control or a user control to mimic that behavior.

WPF: TextBox with ProgressBar

Is it possible in WPF to embed a ProgressBar in the Background of a TextBox?
Yes, but there are varying levels of integration you could achieve.
The simplest way would be to host a ProgressBar and TextBox with see-through background in the same Grid:
<Grid>
<ProgressBar/>
<TextBox Background="#00ffffff"/>
</Grid>
Importantly, the background color is transparent but visible to hit testing. #00000000 would not work as expected because clicking on the TextBox would actually be clicking on the ProgressBar.
You could also retemplate the TextBox to incorporate the ProgressBar more intrinsically into its template. However, this would be of limited use unless you wrote your own control while you're at it.

Resources