Change style of Expander ToggleButton in Silverlight Toolkit? - wpf

I have an Expander in Silverlight 4 that I am trying to style. Specifically, I want to override the default look of the ToggleButton used in the Expander. How do I go about doing this? I've written some style for the Expander so far, but I can seem to find the place to override the default ToggleButton style.

This MSDN page gives a pretty complete description of what is needed to override the Expander.
If you have Expression Blend, another option is to start a new project in Blend, insert an expander on your window/usercontrol, then right-click on it and choose 'Edit Template'. Then you can change just the pieces you want. For my needs, this functionality in Blend is worth the cost of this software by itself.

You will need to replace the whole expander template since the expander stores the togglebutton templates (it has one for each direction) in its template and offers no way for you to provide your own.

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.

Expander in wpf with icon button

I have expander in wpf. I need Expander with header icon(as Notes icon) on right side without change the expander icon. From that i have to drag and drop on chart lines and make it as a small notes.
Try using and changing the controltemplate for the default expander. You can find it here. You use the template found on the website and put your Notes icon somewhere in between (in the header section). Just play around with it and you will find that it is rather easy to customize it. Have fun!

Silverlight Toolkit Expander Button Style/Icon

I'm looking for an easy way to change the styling of the expander button in the Silverlight Toolkit Expander control. For example:
Smaller or larger icon.
Replace the icon with another one.
Change the colours of the icon being used.
TIA
Craig
What you're describing is essentially the bread & butter of what Expression Blend is good for. In Blend you would just right-click your control and choose to edit a copy of the template. Then you would find the Toggle Button, and then edit THAT template.
Otherwise, you'll need to find the Control Template for the expander in your ToolkitStyles.xaml though it's much easier with Expression Blend though. You'll find Templates for all four directions an expander and go.
A quick solution search for;
<Style TargetType="toolkit:Expander" x:Key="DefaultExpanderStyle">
Should produce your default template you can either edit directly or make a copy of (just make sure to rename the Key name if you copy it) and that way you have all your States & Transitions etc already also. Remember your culprit will be the embedded ToggleButton inside the template for whichever direction expander you're wanting to edit.
Hope this helps.

Style a WPF Expander to look like an Outlook ListView group header

How can you style a WPF Expander image to be +/- e.g. to look like an Outlook ListView group header as shown in the image below:
Open
Closed
Not exactly but close enough, check out this article by Karl Shifflet on WPF Sample Series – ListBox Grouping, Sorting, Subtotals and Collapsible Regions from the WPF LOB Tour Materials
(source: wordpress.com)
You would have to override the Expander's ControlTemplate, and change the ContentControl with the TemplateBinding of Header (this is usually a ToggleButton) with your header content.
In your case this is the +/- image/geometry and text.
However, I would go a different route than using an Expander. Since you're using a very specific orientation, I would just borrow the ToggleButton+ContentControl interaction that the default Expander ContentControl combines, and create a new Style/ControlTemplate for the ToggleButton instead.
The primary reason why I recommend this instead of overriding the ControlTemplate of the Expander is that Expander has a very large default ControlTemplate definition, and you won't have to deal with overriding all of the ExpandDirection options.
Alternately, you could just ignore the ExpandDirection property of the Expander and remove the ControlTemplate trigger code and associated Styles which deal with that.

Changing the style of a Combo-Box in WPF (in Blend preferably)

I'm having some issues trying to change the look / style of a combo box in Expression Blend / WPF. While there are tutorials out there describing setting styles for buttons, there seem to be a few wrinkles with ComboBox controls.
Can anyone offer any advice, or point me towards good tutorials that cover re-styling something more complex than a button?
The ComboBox style template has 3 parts to it.
The ContentPresenter you should have come across styling Buttons.
There is a Part_Popup that you should find easy to change properties on and style.
The last part is a ToggleButton, to style that you need to "edit a copy" again and create another new style template for the ToggleButton.
Have a look at BeaCostas SolarSytem Listbox it's a lovely piece of work.

Resources