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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:56:17+00:00 2026-06-07T13:56:17+00:00

I would like to load vector graphics stored as XAML files (separate files, not

  • 0

I would like to load vector graphics stored as XAML files (separate files, not in a dictionary), embedded in my application, and I have a few questions to do so:

  1. XAML looks a bit ambiguous, since it can be used to represent either static resources like vector images, or interfaces which are being dynamically built like the ones in WPF. Because of this, the format of a XAML vector image is unclear to me : what should be the root element, like the “svg” tag for svg vector images ? Currently, I’m using a Canvas as the top element since I want to plot my graphics in another Canvas.

  2. What is the best method to load those file programmatically (I mean, to create the Canvas from the xaml files) ? I’ve seen (and tried) different solutions with XamlReader, but nothing worked: the app crashes and the debugger does not help (most problems I’ve encountered seem to occur during the parsing, and the error message was unclear).

I’ve read http://learnwpf.com/post/2006/06/04/How-do-I-Include-Vector-Based-Image-Resources-in-my-WPF-Application.aspx, but the link to the article dealing with resource files loading is dead, and the images are not created using C# code.

  • 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-06-07T13:56:18+00:00Added an answer on June 7, 2026 at 1:56 pm

    Okay, I found the solution by myself and here it is :

    My project is named “Editor”, and I’ve placed the XAML file I want to read in a “Graphics” folder. This file is named “Image.xaml”.
    The project tree looks like this :

    enter image description here

    The XAML file itself holds this code :

    <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            Width="40" Height="40">
        <Rectangle Canvas.Left="0" Canvas.Top="0" Fill="White" Stroke="Black" StrokeThickness="1" Height="40" Width="40" />
        <!-- ... -->
    </Canvas>
    

    (the xaml namespace ‘xmlns’ reference is needed)

    The code used to load the file is :

    StreamResourceInfo sr = Application.GetResourceStream(new Uri("Editor;component/Graphics/Image.xaml", UriKind.Relative));
    Canvas result = (Canvas)XamlReader.Load(new XmlTextReader(sr.Stream));
    layoutRoot.Children.Add(result);
    

    ‘layoutRoot’ being the name of the main Canvas of my application.

    Last subtility : the property ‘BuildAction’ of the *.xaml file must be set to ‘Resource’, or you will encounter a XamlParseException with hexadecimal value 0x0C (to change this property, right-click on the file in the project treeview).

    Hope this can help.

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

Sidebar

Related Questions

I have some vector graphic files in XAML format and I would like to
I have a C# .Net 2.0CF application where I would like to load a
I have a list of files on a server and would like to load
I have an assembly I would like to load from a sub-folder of the
I have several PDF templates that I would like to load and modify and
I have been toying with the modulino perl pattern and would like to load
I have been working on a web page and would like to load multiple
I have the following HTML: <div id=mydiv> </div> I would like to load content
I would like to load some data from an access-database in my C#-application. But
I would like to load textures, and then have them be used by multiple

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.