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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:38:18+00:00 2026-05-28T02:38:18+00:00

I have built a simple StreamGeometry, using MSDN example: StreamGeometry geometry = new StreamGeometry();

  • 0

I have built a simple StreamGeometry, using MSDN example:

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), true /* is stroked */, false /* is smooth join */);
     ctx.LineTo(new Point(100, 50), true /* is stroked */, false /* is smooth join */);
 }
 return geometry;

How can I get back the Point objects from the StreamGeometry?
I can’t seem to find any suitable method. All I can see is ToString(), which gives me the mini-language format : {M10,100L100,100 100,50z}

  • 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-28T02:38:19+00:00Added an answer on May 28, 2026 at 2:38 am

    here’s what we did for a similar task. Please note, your geometries mustn’t contain nothing bar the lines. Basically it’s a tiny level of abstraction on top of Geometry, Stroke() returns a tuple with the mimilanguage and the collection of Points. You can make Navigator bindable by writing a simple behavior, please let me know if interested and I’ll adjust my answer for it.

    Update 1 – the function, which accepts minilang expression and returns a Point array:

    public static Point[] Parse(string minilanguage)
            {
                // leave just M's
                minilanguage = minilanguage.ToUpper().Replace("M", string.Empty);
    
                // remove spaces
                minilanguage = minilanguage
                    .ToCharArray()
                    .Where(t => t != ' ')
                    .Select(t => t.ToString())
                    .Aggregate((f, s) => f + s).ToString();
    
    
                return minilanguage
                    .Split("L".ToCharArray())
                    .Select(t => Point.Parse(t))
                    .ToArray();
            }
    

    Code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    
    namespace GeometryParts
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
    
                this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
            }
    
            void MainWindow_Loaded(object sender, RoutedEventArgs e)
            {
                Navigator navigator = new Navigator(0, 0);
    
                navigator.NavigateTo(30, 30);
                navigator.NavigateTo(60, 0);
    
                Tuple<string, Point[]> stroke = navigator.Stroke();
                this.g.Data = Geometry.Parse(stroke.Item1);
    
                MessageBox.Show(stroke.Item2.Length.ToString());
            }
        }
    
    
        public class Navigator
        {
            private List<Point> points = new List<Point>();
    
            public Navigator(double x, double y)
            {
                this.points.Add(new Point(x, y));
            }
    
            public void NavigateTo(double x, double y)
            {
                this.points.Add(new Point(x, y));
            }
    
            public Tuple<string, Point[]> Stroke()
            {
                string path = this.points.Select(t => t.ToString()).Aggregate((f, s) => "L" + f + " L" + s);
                path = "M" + path.Substring(2, path.Length - 2);
    
                Tuple<string, Point[]> stroke = new Tuple<string, Point[]>(path, this.points.ToArray());
                points.Clear();
    
                return stroke;
            }
        }
    }
    

    Markup:

    <Window x:Class="GeometryParts.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <Path Stroke="Gray" StrokeThickness="2" x:Name="g" />
        </Grid>
    </Window>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built a very simple blog application using Ruby on Rails. New to
I have a simple table view which I have built using an example from
Does Python have a built-in, simple way of encoding/decoding strings using a password? Something
We have a simple file browser on our intranet, built using ASP/vbscript. The files
I have built a simple website monitoring application using Indy TIdhttp component. I want
I have built a variety of little scripts using Ruby's very simple Queue class,
I'm learning to develop apps using Qt Creator. I have built a simple app
I have built a very simple CakePHP website using the Auth component and have
I have built a website using php and simple HTML/CSS for a client. In
I have built a simple tour on my website that will be coded using

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.