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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:14:40+00:00 2026-05-15T13:14:40+00:00

I am looking for a way to create non-stroked regions for a StreamGeometry in

  • 0

I am looking for a way to create non-stroked regions for a StreamGeometry in xaml.

In other words, I want to know if it is possible to recreate the following code (taken from msdn) with the StreamGeometry Xaml markup syntax.

StreamGeometry geometry = new StreamGeometry();
geometry.FillRule = FillRule.EvenOdd;

using (StreamGeometryContext ctx = geometry.Open())
{

    ctx.BeginFigure(new Point(10, 100), true /* is filled */, true /* is closed */);

    ctx.LineTo(new Point(100, 100), false/* is not stroked */, false /* is smooth join */);

    ctx.LineTo(new Point(100, 50), true /* is stroked */, false /* is smooth join */);
}

I’m looking for a solution which works in WPF since Silverlight doesn’t have a StreamGeometry.

  • 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-15T13:14:41+00:00Added an answer on May 15, 2026 at 1:14 pm

    Here is a direct translation using a PathGeometry:

    <PathGeometry FillRule="EvenOdd">
      <PathFigure StartPoint="10,100" IsFilled="true" IsClosed="true">
        <LineSegment Point="100,100" IsStroked="false" IsSmoothJoin="false" />
        <LineSegment Point="100,50" IsStroked="true" IsSmoothJoin="false" />
      </PathFigure>
    </PathGeometry>
    

    This can be simplified by omitting the default values for FillRule, IsFilled, IsStroked and IsSmoothJoin, resulting in this:

    <PathGeometry>
      <PathFigure StartPoint="10,100" IsClosed="true">
        <LineSegment Point="100,100" IsStroked="false" />
        <LineSegment Point="100,50" />
      </PathFigure>
    </PathGeometry>
    

    This must be done with a PathGeometry, not with the geometry mini-language (eg “M10,100 L100,100 100,50”) because the mini-language provides no way to set IsStroked=false.

    Since you need a StreamGeometry, I recommend you use GeometryExtensions.DrawGeometry method in this answer to convert the PathGeometry defined in XAML into a StreamGeometry.

    I would be inclined to do this using a markup extension:

    <local:ConvertToStreamGeometry>
      <PathGeometry>
        <PathFigure StartPoint="10,100" IsClosed="true">
          <LineSegment Point="100,100" IsStroked="false" />
          <LineSegment Point="100,50" />
        </PathFigure>
      </PathGeometry>
    </local:ConvertToStreamGeometry>
    

    The implementation of the markup extension is trivial:

    [ContentProperty("Geometry")]
    public class ConvertToStreamGeometry : MarkupExtension
    {
      public Geometry Geometry { get; set; }
      public override object ProvideValue(IServiceProvider serviceProvider)
      {
        var result = new StreamGeometry();
        using(var ctx = result.Open())
          ctx.DrawGeometry(Geometry);
        return result;
      }
    }
    

    Note that this calls the GeometryExtensions.DrawGeometry extension method from the code in my earlier answer.

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

Sidebar

Related Questions

I looking for a way to create Delta Diff Patches of Large Binary Files
I am looking for a way to create a ZIP file from a folder
I'm looking for a way to create an online form that will update an
I'm looking for a way to create an it will look cool effect for
I'm looking for a way to create a data access layer that can either
I am looking for a way to create a <ul> of items that I
I am looking for a way to create a program in unmanaged c++ that
I'm looking at a way to create a summary of transactions within a certain
I'm looking for a way to create valid UTF-16 JavaScript escape sequence characters (including
I am looking for a way to create/detect a cookie on a local host

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.