This project has moved and is read-only. For the latest updates, please go here.

Toolkit Controls in a Toolbar

Apr 24, 2014 at 9:09 AM
In my WPF application I have a toolbar which contains an IntegerUpDown and a DropDownButton. The problem is that the IntegerUpDown looks very different than the TextBox I have in the same toolbar. Also the DropDownButton has a completely different style than the standard Button in the toolbar.

What is the easiest way to assign the default ToolBar TextBox style to an IntegerUpDown and the default ToolBar Button style to a DropDownButton?
Apr 24, 2014 at 9:16 AM
I tried these but they don't work because the type of the control does not match:
Style="{StaticResource {x:Static ToolBar.TextBoxStyleKey}}"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Apr 24, 2014 at 1:26 PM
Hi,

What is so different in the style of TextBox vs IntegerUpDown and Button vs DropDownButton ? I'm using Windows 8.1 and they all have the gray look with lignt blue when mouseover or pressed. :
 <Grid>
      <ToolBar Height="200" Width="150">
         <StackPanel>
            <TextBox Text="Regular TextBox" />
            <xctk:IntegerUpDown Value="25" />
            <Button Content="Regular Button" />
            <xctk:DropDownButton Content="My Drop Down" />
         </StackPanel>
      </ToolBar>
   </Grid>
Can you add an image or code ? What system are you using ?
Apr 24, 2014 at 2:53 PM
You're right, in your case they look the same (probably because the controls are inside a StackPanel? or because the ToolBar is not inside a ToolBarTray?).

Usually I create my toolbars like this:
<Window x:Class="StyleTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        Title="MainWindow" Height="100" Width="500">
    <DockPanel>
        <ToolBarTray DockPanel.Dock="Top">
            <ToolBar ToolBarTray.IsLocked="True" >
                <TextBox Width="70" Text="TextBox" />
                <xctk:IntegerUpDown Width="70" Value="100" />
                <Button>Button</Button>
                <xctk:DropDownButton>DropDownButton</xctk:DropDownButton>
            </ToolBar>
        </ToolBarTray>
    </DockPanel>
</Window>
In this case the TextBox and the Button change to a flat appearance (which is what I want) but the Toolkit controls keep their default non-flat style. I'm using Windows 7.
Apr 24, 2014 at 4:50 PM
Hi,

Yes, removing the StackPanel changes the style of the Button and the textbox to use the ToolBar.TextBoxStyle and ToolBar.ButtonStyle. Unfortunately, the Toolkit's controls don't have a Toolbar style.

I believe redefining the style of the DropDownButton and IntegerUpDown would do the job. These files are located here :

-Xceed.Wpf.Toolkit/NumericUpDown/Themes/Generic.xaml
-Xceed.Wpf.Toolkit/DropDownButton/Themes/Generic.xaml