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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:15:10+00:00 2026-06-13T15:15:10+00:00

I have a GUI that uses a treeview which renders data objects into rows,

  • 0

I have a GUI that uses a treeview which renders data objects into rows, including icons to denote object type etc for each row. Im noticing that the addition of the icon files into each row slows down the load and render a lot so Im toying with the idea of rewriting the icons as drawings. Ive done one proof of concept and mimicked an icon with the following

<Border Width="15" Height="15" BorderThickness="0" CornerRadius="4,4,4,4" Background="#22bb22" VerticalAlignment="Center">
            <Path StrokeThickness="1.5" Stroke="#FFFFFFFF" Data="M 2,4 C 2,4 10,4 9,12 M 2,7 C 2,7 7,7 6,12 M 2,10.5 L 4,10.5"/>
        </Border>

However I can’t see how to include this as a static resource in my XAML. I want to load this drawing once and to re-use it throughout the application without having to redraw each time. Ive done something similar with images, creating a resource dictionary, then having a StaticResourceExtension class to look up via a key in that dictionary to find the image in the cache, and bind that to the source of the image tag. eg

<Image Source="{y:ImageStaticResource {Binding IconString}}" Margin="0,0,0,0"></Image>

ImageStaticResource is my custom class, and the IconString property of the datacontext is the key that looks up in the dictionary, which returns a string of the location of the image. This works and works very well. But I want to do something similar with these drawings but cant quite figure out how. Ive created a new Static Resource extension that does exactly the same but loads a different resource dictionary, the first entry of which is as follows

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"                     
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

        <Border x:Key="Default" Width="15" Height="15" BorderThickness="0"></Border>

        <Border x:Key="..\Resources\Images\AccountOnly.ico" Width="15" Height="15" BorderThickness="0" CornerRadius="4,4,4,4" Background="#22bb22" VerticalAlignment="Center">
            <Path StrokeThickness="1.5" Stroke="#FFFFFFFF" Data="M 2,4 C 2,4 10,4 9,12 M 2,7 C 2,7 7,7 6,12 M 2,10.5 L 4,10.5"/>
        </Border>

    </ResourceDictionary>

So I am hoping to look up this bordered drawing by key (as all icons can be represented by a border surrounding a drawing but cannot figure out what to do. Can anyone offer suggestions?

  • 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-13T15:15:11+00:00Added an answer on June 13, 2026 at 3:15 pm

    You could achieve the same visual result by filling a Rectangle control with a DrawingBrush that is defined as resource:

    <Window.Resources>
        <DrawingBrush x:Key="SomeIcon" Stretch="None">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Brush="#22bb22">
                        <GeometryDrawing.Geometry>
                            <RectangleGeometry Rect="0,0,15,15" RadiusX="4" RadiusY="4"/>
                        </GeometryDrawing.Geometry>
                    </GeometryDrawing>
                    <GeometryDrawing Geometry="M 2,4 C 2,4 10,4 9,12 M 2,7 C 2,7 7,7 6,12 M 2,10.5 L 4,10.5">
                        <GeometryDrawing.Pen>
                            <Pen Brush="#FFFFFFFF" Thickness="1.5"/>
                        </GeometryDrawing.Pen>
                    </GeometryDrawing>
                </DrawingGroup>
            </DrawingBrush.Drawing>
        </DrawingBrush>
    </Window.Resources>
    
    ...
    
    <Rectangle Width="15" Height="15" Fill="{StaticResource SomeIcon}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Python GUI that uses Tkinter. I have to SSH into another
I have a simple GUI program that uses a custom stringstream to redirect output
I have created a GUI program that uses a class to perform some tasks.
I have a simple openGL GUI that has uses a bmp as a texture.
I have a GUI application that uses an InputVerifier to check the content of
I have written a desktop application that uses a web page as the GUI,
I have some data that uses unixtime . I'm using Python and MySQL. I
I have a gui that uses card layout as layout manager.this gui has two
I have an Android application that uses speech recognition in an Activity. The GUI
I have an application that uses Flash for the GUI and Python for the

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.