Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6694195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:04:25+00:00 2026-05-26T06:04:25+00:00

Styling gurus, I need help coming up with an Expander style that looks like

  • 0

Styling gurus, I need help coming up with an Expander style that looks like the one found in Visual Studio’s code editor. So far, I have come up with this

<ControlTemplate x:Key="ExpanderToggleButton" TargetType="ToggleButton">               
                <Border
                    SnapsToDevicePixels="true"
                    Height="12" 
                    Name="Border"
                    CornerRadius="0"                   
                    Margin="2,4" 
                    Background="Transparent"                      
                    BorderBrush="Black"                       
                    BorderThickness="0.5" >                   
                <TextBlock  Name="Arrow" Text="+"  
                            Foreground="{StaticResource GlyphBrush}" 
                            HorizontalAlignment="Center"  VerticalAlignment="Center" />
            </Border>
                <ControlTemplate.Triggers>                  
                <Trigger Property="IsChecked" Value="true">                      
                    <Setter TargetName="Arrow" Property="Text" Value="-" />
                </Trigger>                 
            </ControlTemplate.Triggers>
        </ControlTemplate>

which looks like this in collapsed state.

enter image description here

It clearly needs some fine tuning, which is what I need help with. My challenge is getting the correct button content and its vertical alignment. In the attached figure, the expanders are simply being added to a dock panel, so I do not understand why the button content is not centered as specified.

TIA.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:04:25+00:00Added an answer on May 26, 2026 at 6:04 am

    Here is a style I use.

    <Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid Width="14" Height="14">
                        <Rectangle Fill="{DynamicResource primaryBackgroundBrush}" />
                        <Border Name="ExpandBorder" RenderOptions.EdgeMode="Aliased" BorderBrush="Black" BorderThickness="2">
                            <Path RenderOptions.EdgeMode="Aliased" Name="ExpandPath" Stroke="Black" Margin="0" StrokeThickness="2" Data="M 5 1 L 5 9 M 1 5 L 9 5" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Data" TargetName="ExpandPath" Value="M 1 5 L 9 5"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="ExpandBorder" Property="BorderBrush" Value="Gray" />
                            <Setter TargetName="ExpandPath" Property="Stroke" Value="Gray" />
                            <Setter Property="Data" TargetName="ExpandPath" Value=""/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently changing styling from code behind by doing: Div.Style[StyleAttribute] = MyValue; I
In several android styling tutorials parent style elements are used that i can not
I'm wondering why styling an element within a specific class, like this: .reddish H1
Is there a nicer way of styling a <hr /> tag using CSS, that
Why the following styling of the link does not work ? <html> <head> <style
I am styling my top level <li> to look like tabs. and on rollover
I have a question about styling Icefaces. I have a minimal application that can
I'm trying to add css styling to Facebook Like Box XFBML file but it
I am using a jQuery that is styling my checkbox, meaning that, on click,
While styling the jQuery autocomplete plugin, I get the following HTML code hardwired to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.