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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:53:27+00:00 2026-05-19T23:53:27+00:00

I have some vector graphic files in XAML format and I would like to

  • 0

I have some vector graphic files in XAML format and I would like to use them as icons/buttons in an Silverlight application.
The approach I would have preferred is to use an Image control and set its source property to the .xaml file, much like I can use a regular bitmap image.

But its not that easy and I have tried to include them as ControlTemplates in resource dictionary’s and I even tried to create a custom control that would load the Xaml dynamically but I wasn’t really pleased with the result, since I needed to wrap them in ViewBox controls to allow dynamic size etc.

So my questions is if any one has any best practice advices how to best use my xaml icons?
I could copy-paste the xaml when needed but I really dont like that approach.

Thanks in advance.

  • 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-19T23:53:28+00:00Added an answer on May 19, 2026 at 11:53 pm

    JWendel,

    You should post some examples of your XAML icons to clarify, but any content control, like Button‘s and ContentControl‘s, have both Content, and ContentTemplate properties. A shared ContentTemplate example is shown below:

    <UserControl
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
        xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    >
        <UserControl.Resources>
            <Style x:Key="MyTriangleIcon" TargetType="ContentControl">
                <Setter Property="ContentTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Grid>
                                <Polygon Fill="Black" Stroke="Black">
                                    <Polygon.Points>
                                        <Point X="0" Y="100"/>
                                        <Point X="100" Y="0"/>
                                        <Point X="100" Y="100"/>
                                    </Polygon.Points>
                                </Polygon>
                                <Polygon Fill="Red" Stroke="Red">
                                    <Polygon.Points>
                                        <Point X="100" Y="0"/>
                                        <Point X="0" Y="100"/>
                                        <Point X="0" Y="0"/>
                                    </Polygon.Points>
                                </Polygon>
                            </Grid>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </UserControl.Resources>
    
        <StackPanel Background="White">
            <Button Width="120" Height="120" Style="{StaticResource MyTriangleIcon}" />
            <Button Width="120" Height="120" Style="{StaticResource MyTriangleIcon}" />
        </StackPanel>
    
    </UserControl>
    

    You can paste the above content into my XamlViewer to quickly see the results.

    Good luck,
    Jim McCurdy

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

Sidebar

Related Questions

I have some classes layed out like this class A { public virtual void
I have some code like this in a winforms app I was writing to
We have some files on our website that users of our software can download.
I have some strings of xxh:yym format where xx is hours and yy is
I have a program that draws some vector graphics using System.Drawing and the Graphics
I have a situation like below in which I have some problem in freeing
I have 2D closed vector paths, specified in SVG paths-like syntax - i.e. these
I'm building a Flex application that creates neat vector images based on some options/filters.
I have some complex graphs made using matplotlib. Saving them to a pdf using
I have some socket connection code that makes use of boost::asio which reads from

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.