WinForms Panel's Fixed3D border is not rendered with the OS visual styles - winforms

If the BorderStyle property of many intrinsic WinForms controls, such as ListView or TreeView, is set to Fixed3D, the border of such a control is rendered using the OS visual styles (sure, if they are enabled). However, this does not work for the Panel control. Compare the ListView and Panel controls on the screenshot below:
Is there a trick that can cause the 3D border of the Panel control to be rendered with the visual styles? If not, what is workaround (say, using custom painting)?

Related

Bootstrap css style of vertical tab control for WPF?

I'm looking for a bootstrap CSS style of a vertical tab control, like at this page:
https://dbtek.github.io/bootstrap-vertical-tabs/demo.html
If I'm going to do it myself, what WPF control should I begin with as the base class? (I don't think the WPF tabcontrol should be a starting point because the styles are so different)
Thanks
You can re-style the TabControl and the TabItems to look like you want. It may require some effort though.
You can right-click on a TabControl in design mode in Visual Studio or in Blend and choose Edit Template->Edit a Copy to copy the default style into your XAML markup and then edit it as per your requirements. Edit Additional Templates->Edit Generated Item Container (ItemContainerStyle) will do the same thing for the TabItem container.
Also note that you can set the TabStripPlacement property of the TabControl to Left to change the position of the tabs.

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.

Style WPF Expander icon like TreeView expander

I would like to style my WPF expander like the expanders used in this TreeView from Windows 7 (see screenshot below). Are there any styles available to do this?
Edit: I am interested in the expander style -- specifically the small triangular expansion indicator
See Ritch's comment above -- the solution is to use Blend to extract the default control template for the TreeView.
Turns out the tree view default template contains a special control template for a ToggleButton that is being used to display the expansion indicator. If you take that template and inject it into the template that Expander uses for its expansion toggle button then you are all set

WPF Custom control template

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.

WPF Design view in Visual Studio 2010--scroll the scrollbar?

I just added a ScrollViewer to my WPF app. Now some of my content is hidden because it is at the bottom of the ScrollViewer--this is intentional. However, is there any way in the Design view of Visual Studio 2010 to scroll a scrollbar so that I can preview what my app looks like when the scrollbar is at different positions? It would be convenient to check this out without having to build my Solution and run my app, just to scroll down and make sure things look as I expect.
My ScrollViewer is contained in a UserControl that does not have a height set on it. I set my ScrollViewer's height to Auto so all the contents of the ScrollViewer show in Design view in my UserControl--this way, I can see what I'm doing. I set the height of the Window that includes the UserControl, so when I run my app the ScrollViewer is bounded by that Window height, as desired.
I just removed these properties from my UserControl in Visual Studio.
d:DesignHeight and d:DesignWidth
Like yours, my ScrollViewer's height was already set to Auto.

Resources