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 378841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:50:01+00:00 2026-05-12T14:50:01+00:00

I have a listbox with a style that has rounded corners. I’d like to

  • 0

I have a listbox with a style that has rounded corners. I’d like to add a toolbar inside the listbox that pertains to that specific list box. Currently, if I add a toolbar inside the grid that contains a listbox, it will overlap the last item in the row (depending on the height of the toolbar). Does anyone have any ideas on the best way to implement this? I know I could create a border control that matches the look of the listbox edges and then place a listbox that has a style without borders inside the main border stacked with the toolbar at the bottom, but I’m hoping there is a better way to keep my current listbox style and just place a toolbar inside the bottom of the listbox that doesn’t hide any listbox items.

Thanks,

John

  • 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-12T14:50:02+00:00Added an answer on May 12, 2026 at 2:50 pm

    Not sure I follow entirely, but I think you have a couple of options:

    1. Integrate the ToolBar into the ListBox template, probably by writing a control that extends ListBox and adds a property to set the ToolBar items.
    2. Turn off the Border on the ListBox and stick your own Border around it that also encompasses the ToolBar.

    2 is a little easier and is probably what you want.

    Example of 1

    (I didn’t bother subclassing ListBox here – I just hard-coded some ToolBar items instead)

        <Grid Margin="10">
            <ListBox>
                <ListBox.Template>
                    <ControlTemplate TargetType="ListBox">
                        <Border BorderThickness="{TemplateBinding Border.BorderThickness}" Padding="1,1,1,1" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" Name="Bd" SnapsToDevicePixels="True" CornerRadius="5">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
    
                                <ToolBarTray Background="White">
                                    <ToolBar Band="1" BandIndex="1">
                                        <Button>
                                            Cut
                                        </Button>
                                        <Button>
                                            Copy
                                        </Button>
                                        <Button>
                                            Paste
                                        </Button>
                                    </ToolBar>
                                    <ToolBar Band="2" BandIndex="1">
                                        <Button>
                                            Undo
                                        </Button>
                                        <Button>
                                            Redo
                                        </Button>
                                    </ToolBar>
                                </ToolBarTray>
                                <ScrollViewer Grid.Row="1" Padding="{TemplateBinding Control.Padding}" Focusable="False">
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                                </ScrollViewer>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="UIElement.IsEnabled" Value="False">
                                <Setter Property="Panel.Background" TargetName="Bd">
                                    <Setter.Value>
                                        <DynamicResource ResourceKey="{x:Static SystemColors.ControlBrushKey}" />
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="ItemsControl.IsGrouping" Value="True">
                                <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </ListBox.Template>
                <ListBoxItem>One</ListBoxItem>
                <ListBoxItem>Two</ListBoxItem>
                <ListBoxItem>Three</ListBoxItem>
            </ListBox>
        </Grid>
    

    Example of 2

    <Grid Margin="10">
        <Border CornerRadius="5" BorderThickness="1" BorderBrush="Black" Padding="1">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
    
                <ToolBarTray Background="White">
                    <ToolBar Band="1" BandIndex="1">
                        <Button>
                            Cut
                        </Button>
                        <Button>
                            Copy
                        </Button>
                        <Button>
                            Paste
                        </Button>
                    </ToolBar>
                    <ToolBar Band="2" BandIndex="1">
                        <Button>
                            Undo
                        </Button>
                        <Button>
                            Redo
                        </Button>
                    </ToolBar>
                </ToolBarTray>
                <ListBox Grid.Row="1" BorderThickness="0">
                    <ListBoxItem>One</ListBoxItem>
                    <ListBoxItem>Two</ListBoxItem>
                    <ListBoxItem>Three</ListBoxItem>
                </ListBox>
            </Grid>
        </Border>
    </Grid>
    

    In both cases, the result looks similar:

    alt text http://img42.imageshack.us/img42/372/screenshotof.png

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

Sidebar

Related Questions

I have a ListBox that has a style defined for ListBoxItems. Inside this style,
I have an order entry form that has a ListBox with a list of
I have a ListBox that is bound to a list of CustomerViewModel-objects, that each
I have a WPF application with ListBox that display list of items. Each item
I have a ListBox that each of its items has a button, I set
I have created styled a ListBox in WPF so that it is rendered as
I have a listbox where the items contain checkboxes: <ListBox Style={StaticResource CheckBoxListStyle} Name=EditListBox> <ListBox.ItemTemplate>
I have this: <ListBox x:Name=PART_lstAttributes Grid.Row=1 Style={StaticResource GlossyBlackListBox}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock x:Name=txtAttributeName Text={Binding
I have a listbox that is databound to a Collection of objects. The listbox
I have a ListBox that when in focus, and when I have an item

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.