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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:37:55+00:00 2026-05-26T13:37:55+00:00

I have WPF WrapPanel, and a toolbar inside. The WrapPanel is red and the

  • 0

I have WPF WrapPanel, and a toolbar inside. The WrapPanel is red and the toolbar is blue.

enter image description here

Could anybody explain me, where did indent of WrapPanel on the top, left etc. come from, and how I can remove it?

Here is the sample code of the image:

<WrapPanel Orientation="Horizontal" Background="Red">
       <ToolBar x:Name="tFirst" Background="Blue" ToolBarTray.IsLocked="True">
         <Button ToolTip="New" Content="New" />
         <Button ToolTip="Save" Content="Save" />
         <Button ToolTip="Delete" Content="Delete" />
       </ToolBar>
</WrapPanel>

Thanks in advance.

UPDATE: the problem is only with Toolbar, I just changed WrapPanel to DockPanel, and the problem is still exists.

  • 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-26T13:37:56+00:00Added an answer on May 26, 2026 at 1:37 pm

    It’s probably something about the default, built-in control template of the ToolBar control.

    A quick fix is, obviously, to set Margin to -2 for example.

    ToolBar is internally quite complex, it consists of a Grid, a Border, a DockPanel etc. you can try and traverse it with VisualTreeHelper. For example:

    var dockPanel = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(tFirst, 0), 1), 0);
    

    retrieves the DockPanel object. You can try and find the control with Margin or Padding greater than 0, and if you succeed you could probably even reset it from code (something like: (dockPanel as DockPanel).Margin = 0;)

    In XAML, I’d try overriding ToolBar's control template (as demonstrated in http://msdn.microsoft.com/en-us/library/aa970772(v=vs.85).aspx – although this example is of course overly complex for your purpose, the principle is the same).

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

Sidebar

Related Questions

I have WPF control hosted inside a WinForms control using ElementHost. The WinForms control
I have one WrapPanel With name PageWrapPanel In Main window of my WPF application
I have ProjectA(WPFApplication) that references ProjectB(ClassLibrary) . Inside ProjectB i have wpf window that
I have WPF Span that is used as a source to a TextBlock. I
I have WPF Application where I have One main form and other user controls
I have WPF Form which has many buttons with the same code. Appearance of
I have WPF app with 2 windows - whats the best way to syncronise
I have WPF C# application that communicate with a PLC (i.e. write/read Omron PLC's
I have a WPF application which connects to a remote database over internet and
I have a WPF application, where as part of the startup, I need 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.