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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:28:00+00:00 2026-05-10T21:28:00+00:00

I have a border element with rounded corners containing a 3×3 grid. The corners

  • 0

I have a border element with rounded corners containing a 3×3 grid. The corners of the grid are sticking out of the border. How can I fix that? I tried using ClipToBounds but didn’t get anywhere. Thanks for your help

  • 1 1 Answer
  • 2 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. 2026-05-10T21:28:01+00:00Added an answer on May 10, 2026 at 9:28 pm

    Here are the highlights of this thread mentioned by Jobi

    • None of the decorators (i.e. Border) or layout panels (i.e. Stackpanel) come with this behavior out-of-the-box.
    • ClipToBounds is for layout. ClipToBounds does not prevent an element from drawing outside its bounds; it just prevents children’s layouts from ‘spilling’. Additionally ClipToBounds=True is not needed for most elements because their implementations dont allow their content’s layout to spill anyway. The most notable exception is Canvas.
    • Finally Border considers the rounded corners to be drawings inside the bounds of its layout.

    Here is an implementation of a class that inherits from Border and implements the proper functionality:

         /// <Remarks>     ///     As a side effect ClippingBorder will surpress any databinding or animation of      ///         its childs UIElement.Clip property until the child is removed from ClippingBorder     /// </Remarks>     public class ClippingBorder : Border {         protected override void OnRender(DrawingContext dc) {             OnApplyChildClip();                         base.OnRender(dc);         }          public override UIElement Child          {             get             {                 return base.Child;             }             set             {                 if (this.Child != value)                 {                     if(this.Child != null)                     {                         // Restore original clipping                         this.Child.SetValue(UIElement.ClipProperty, _oldClip);                     }                      if(value != null)                     {                         _oldClip = value.ReadLocalValue(UIElement.ClipProperty);                     }                     else                      {                         // If we dont set it to null we could leak a Geometry object                         _oldClip = null;                     }                      base.Child = value;                 }             }         }          protected virtual void OnApplyChildClip()         {             UIElement child = this.Child;             if(child != null)             {                 _clipRect.RadiusX = _clipRect.RadiusY = Math.Max(0.0, this.CornerRadius.TopLeft - (this.BorderThickness.Left * 0.5));                 _clipRect.Rect = new Rect(Child.RenderSize);                 child.Clip = _clipRect;             }         }          private RectangleGeometry _clipRect = new RectangleGeometry();         private object _oldClip;     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a normal input element it will show a rounded border with
I have the following markup: http://www.webdevout.net/test?011 As you can see, the li element is
I have an img element set next to a div. I have tried a
I have a website with a backgroundimage in a <div> element that has another
I have this code <html> <head> <style type=text/css> .frame {width: 50em; border: 1px solid
In my test, I have 2 spans both set to display:inline-block with a border
I have a simple extender component that draws 3D borders around any Control. In
I'm currently using a combination of CSS and Div tags to achieve rounded corners
I have a div with border-radius set to some value (let's say 10px), and
I want to write a Style for a Border element when its pressed. But

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.