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

  • Home
  • SEARCH
  • 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 8990661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:32:54+00:00 2026-06-15T22:32:54+00:00

Anyone know of a WPF split button that looks like a regular button in

  • 0

Anyone know of a WPF split button that looks like a regular button in both the Win7 theme and the Win8 theme? I’m using one that looks good for Win7 but sticks out like a sore thumb in Win8:

weird button

I’ve tried the WPF Splitbutton project on codeplex, the Banana Splitbutton and the splitbutton in the Extended WPF Toolkit.

Is there anything out there that gives an Win7-themed button in Win7 and a Win8-themed button in Win8?

I need the control to have a bindable Command property and show a context menu when the down arrow is pressed.

  • 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-06-15T22:32:55+00:00Added an answer on June 15, 2026 at 10:32 pm

    I went with Sten’s approach: nesting a button inside another button. I used a user control to make it re-usable, putting all the elements in the control template so it could put arbitrary content inside the button.

    <UserControl 
      x:Class="VidCoder.Controls.SplitButton"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      mc:Ignorable="d"
      Loaded="SplitButton_OnLoaded">
      <UserControl.Template>
        <ControlTemplate TargetType="{x:Type UserControl}">
          <Button 
            HorizontalAlignment="Left" VerticalAlignment="Top" Name="mainButton" ContextMenuService.Placement="Bottom" 
            Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
            <Button.Content>
              <StackPanel Orientation="Horizontal" UseLayoutRounding="True">
                <ContentPresenter Margin="{TemplateBinding Padding}" />
                <Rectangle Width="1" Fill="#111111" Margin="0,2" />
                <Button Click="OnArrowClick">
                  <Button.Template>
                    <ControlTemplate TargetType="Button">
                      <Grid Background="Transparent" Name="buttonGrid">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                      </Grid>
                    </ControlTemplate>
                  </Button.Template>
                  <Button.Content>
                    <Path Data="M 0,0 L 8,0 L 4,4 Z" Fill="{TemplateBinding Foreground}" Margin="4 0 3 0" VerticalAlignment="Center"/>
                  </Button.Content>
                </Button>
              </StackPanel>
            </Button.Content>
            <Button.ContextMenu>
              <ContextMenu Name="buttonMenu" ItemsSource="{Binding Path=MenuItemsSource, RelativeSource={RelativeSource TemplatedParent}}" />
            </Button.ContextMenu>
          </Button>
        </ControlTemplate>
      </UserControl.Template>
    </UserControl>
    

    The codebehind exposes the menu item collection and Command property:

    public partial class SplitButton : UserControl
    {
        private Button button;
    
        private ObservableCollection<object> menuItemsSource = new ObservableCollection<object>();
    
        public Collection<object> MenuItemsSource { get { return this.menuItemsSource; } }
    
        public SplitButton()
        {
            InitializeComponent();
        }
    
        public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
            "Command",
            typeof (ICommand),
            typeof (SplitButton),
            new UIPropertyMetadata(null, OnCommandChanged));
    
        public ICommand Command
        {
            get
            {
                return (ICommand) GetValue(CommandProperty);
            }
    
            set
            {
                SetValue(CommandProperty, value);
            }
        }
    
        private static void OnCommandChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs)
        {
            if (eventArgs.NewValue != eventArgs.OldValue)
            {
                var splitButton = dependencyObject as SplitButton;
    
                if (splitButton.button != null)
                {
                    splitButton.button.Command = eventArgs.NewValue as ICommand;
                }
            }
        }
    
        private void OnArrowClick(object sender, RoutedEventArgs e)
        {
            var buttonMenu = ContextMenuService.GetContextMenu(this.button);
    
            if (this.menuItemsSource.Count > 0 && buttonMenu != null)
            {
                buttonMenu.IsOpen = !buttonMenu.IsOpen;
                buttonMenu.PlacementTarget = this.button;
                buttonMenu.Placement = PlacementMode.Bottom;
            }
        }
    
        private void SplitButton_OnLoaded(object sender, RoutedEventArgs e)
        {
            this.button = this.Template.FindName("mainButton", this) as Button;
            if (this.Command != null)
            {
                this.button.Command = this.Command;
            }
        }
    }
    

    In use:

    <controls:SplitButton HorizontalAlignment="Left" VerticalAlignment="Top" Command="{Binding TestCommand}">
        <controls:SplitButton.MenuItemsSource>
            <MenuItem Header="ham" Command="{Binding TestCommand2}" />
            <MenuItem Header="sandwiches" />
            <MenuItem Header="yum" />
        </controls:SplitButton.MenuItemsSource>
        <TextBlock Padding="4" Text="Testing" />
    </controls:SplitButton>
    

    Splitbutton usage example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know a WPF control/app that functions like the google Finance graph/chart? Thank
I recently started using WPF and the MVVM framework, one thing that I have
Does anyone know of WPF code examples using Prism in which modules each register
Does anyone know how to make an Inner Glow effect in WPF without using
Anyone know if the Ribbon control (using a Ribbon Window WPF project in VS
Does anyone know some good guides on making Ribbons that actually look good like
Anyone know where I can get a control like the Multi-column Tree-View in WPF?
Does anyone know the correct definition for a sliding window in WPF? What I
Anyone know how I can make a login button in Ruby on Rails for
Anyone know how to set the custom 404 Error pages that the Visual Studio

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.