Fancy Borders

I was trying to draw a “raised” border around my control, something resembling a 3D window border in Windows. I.e. something like white on the outside, gray in the middle, black on the inside (or something like that). I ran into quite a few difficulties. My discoveries so far:

  • If you use a gradient brush as the border background, it will not think they way you expect: see Charles Petzold’s post on gradient brushes
  • While you can make things like <Rectangle> or <Ellipse> to have a width of “Auto” (which might mean “fill the whole parent”), corresponding geometries like <EllipseGeometry>must have absolute widths.
  • I could not find a way to create in XAML a geometry that would be stretchable with the parent control, even using control templates. I am sure it is possible in code.
  • I probably spent too much time trying to draw a fancy border around my control. 🙂
Posted in

Leave a Reply

Your email address will not be published. Required fields are marked *