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

The Archive Base Latest Questions

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

I need to create a custom combo box that display shapes. I created the

  • 0

I need to create a custom combo box that display shapes. I created the shapes by extending the Shape class, and implementing the DefiningGeometry function like this:

public abstract class MyShape : Shape
{


    public static readonly DependencyProperty SizeProperty = DependencyProperty.Register("Size", typeof(Double), typeof(MapShape));
    public static readonly DependencyProperty RotationAngleProperty = DependencyProperty.Register("RotationAngle", typeof(Double), typeof(MapShape), new PropertyMetadata(0.0d));

    public double Size
    {
        get { return (double)this.GetValue(SizeProperty); }
        set { this.SetValue(SizeProperty, value); }
    }

    public double RotationAngle
    {
        get { return (double)this.GetValue(RotationAngleProperty); }
        set { this.SetValue(RotationAngleProperty, value); }
    }

    protected override Geometry DefiningGeometry
    {
        get
        { return null; }
    }
}

I can extend that class and create any other shape I want. for instance, I have one that looks like an arrow:

public class Arrow : MyShape
{
    public Arrow() { 
    }

    protected override Geometry DefiningGeometry
    {
        get
        {
            double oneThird = this.Size / 3;
            double twoThirds = (this.Size * 2) / 3;
            double oneHalf = this.Size / 2;

            Point p1 = new Point(0.0d, oneThird);
            Point p2 = new Point(0.0d, twoThirds);
            Point p3 = new Point(oneHalf, twoThirds);
            Point p4 = new Point(oneHalf, this.Size);

            Point p5 = new Point(this.Size, oneHalf);
            Point p6 = new Point(oneHalf, 0);
            Point p7 = new Point(oneHalf, oneThird);


            List<PathSegment> segments = new List<PathSegment>(3);
            segments.Add(new LineSegment(p1, true));
            segments.Add(new LineSegment(p2, true));
            segments.Add(new LineSegment(p3, true));
            segments.Add(new LineSegment(p4, true));

            segments.Add(new LineSegment(p5, true));
            segments.Add(new LineSegment(p6, true));
            segments.Add(new LineSegment(p7, true));

            List<PathFigure> figures = new List<PathFigure>(1);
            PathFigure pf = new PathFigure(p1, segments, true);
            figures.Add(pf);
            RotateTransform rt = new RotateTransform(this.RotationAngle);

            Geometry g = new PathGeometry(figures, FillRule.EvenOdd, rt);

            return g;
        }
    }
}

I can add this shapes on XAML or code and they work just fine.

Now, those shapes are displayed on a graphics object somewhere in my form which is no relevant. The requirement I have is for the shapes on the graphic object in the form to be changed by the client from a ComboBox. So, basically I need to display the shapes inside the combo box as well. I really don’t need to use these classes I am showing here, it is just for clarification I add them to this note. But I do need to customize the combobox to show shapes in the items. One way I thought is using the ControlTemplate, Any other ideas, code, readings?
Thanks!

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

    If I understood, what you want can be achieved by customizing the ItemTemplate property of the ComboBox.

     <ComboBox ...>
          <ComboBox.ItemTemplate>
              <DataTemplate>
                 <!-- Whatever UI -->
              </DataTemplate>
          </ComboBox.ItemTemplate>
     </ComboBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a custom component which consist of a drop down box,
I need to create a custom Component with JSF 2.0 (not composite component), that
I need to create custom alert box with next icon image. I did with
I need create custom tabbar with super class UITabBarController. But i don,t know how
I need to create a custom shape to add on a WPF form. The
I need to be able to create custom calendars that can omit certain holidays
I need create custom dialog and put JPanel into it. Is it possible?
Need to create a custom DNS name server using C which will check against
I need to create a custom user interface using extJS/JSP which will allow me
I need to create a custom json for the jit library. Should I use

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.