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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:45:59+00:00 2026-05-27T19:45:59+00:00

I need to create UML-like block diagram with connected components dynamically in Silverlight. How

  • 0

I need to create UML-like block diagram with connected components dynamically in Silverlight. How to do this? What controls should be used for this? It is required to add show/hide toggle for some items in the blocks.

  • 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-27T19:45:59+00:00Added an answer on May 27, 2026 at 7:45 pm

    You can use an ItemsControl with a Canvas.

    namespace SlBug1
    {
        using System.Collections.Generic;
        using System.Windows.Controls;
        using System.Windows.Media;
        using System.Windows.Shapes;
    
        public partial class UML : UserControl
        {
            public UML()
            {
                InitializeComponent();
    
                SetupData();
    
                this.DataContext = this;
            }
    
            public object Classes { get; set; }
            public object Arrows { get; set; }
    
            #region Set up data
    
            public void SetupData()
            {
    
                var arrows = new List<Arrow>(
    
                    new Arrow[] {
                        new Arrow(50, 250, 200, 250),
                        new Arrow(50, 50, 200, 220)
                    }
                );
    
                this.Arrows = arrows;
    
                var classes = new List<Class>(
                    new Class[]
                    {
                        new Class { Name = "Line", Methods= new string[] { "Draw", "setColor"} , X=10, Y=11, IsExpanded=true},
                        new Class { Name = "Rectangle", Methods = new string[] { "Draw", "setColor", "setFill"}, X=200, Y=200, IsExpanded=true},
                        new Class { Name = "Circle", Methods = new string[] {"Draw", "setColor", "setFill", "setRadius"}, X=10, Y=200, IsExpanded=false},
                    });
    
                this.Classes = classes;
    
            }
    
            #endregion
    
        }
    
        public class Class
        {
            public string Name { get; set; }
            public IEnumerable<string> Methods { get; set; }
    
            public double X { get; set; }
            public double Y { get; set; }
            public bool IsExpanded { get; set; }
        }
    
        public class Arrow
        {
            public Arrow(double X1, double Y1, double X2, double Y2)
            {
                this.X1 = X1; this.Y1 = Y1;
                this.X2 = X2; this.Y2 = Y2;
            }
    
            public double X1 { get; set; }
            public double Y1 { get; set; }
            public double X2 { get; set; }
            public double Y2 { get; set; }
            public double LX1 { get { return (14 * X2 + X1) / 15; } }
            public double RX1 { get { return (14 * X2 + X1) / 15; } }
            public double LY1 { get { return (14 * Y2 + Y1) / 15 - 10; } }
            public double RY1 { get { return (14 * Y2 + Y1) / 15 + 10; } }
        }
    }
    
        <UserControl x:Class="SlBug1.UML"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
    
        <Grid x:Name="LayoutRoot" Background="White">
    
            <Canvas>
                <ItemsControl x:Name="ArrowsCanvas" ItemsSource="{Binding Arrows}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Canvas>
                                <Line X1="{Binding X1}" X2="{Binding X2}"
                                      Y1="{Binding Y1}" Y2="{Binding Y2}" Stroke="Black" />
                                <Line X1="{Binding LX1}" X2="{Binding X2}"
                                      Y1="{Binding LY1}" Y2="{Binding Y2}" Stroke="Black" />
                                <Line X1="{Binding RX1}" X2="{Binding X2}"
                                      Y1="{Binding RY1}" Y2="{Binding Y2}" Stroke="Black" />
                            </Canvas>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
                <ItemsControl x:Name="UmlCanvas" ItemsSource="{Binding Classes}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <!-- Hack: http://forums.silverlight.net/post/370493.aspx -->
                            <Canvas>
                                <Border Background="LightBlue"
                                Canvas.Left="{Binding X}"
                                Canvas.Top="{Binding Y}"
                                BorderBrush="Black" BorderThickness="2" >
                                    <StackPanel>
                                        <TextBlock Text="{Binding Name}" FontSize="16" />
                                        <ItemsControl 
                                            ItemsSource="{Binding Methods}" 
                                            Margin="10,10,0,0"/>
                                    </StackPanel>
                                </Border>
                            </Canvas>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </Canvas>
        </Grid>
    </UserControl>
    

    The end result looks something like this:

    UML diagram - pardon me for the brain-dead inheritance

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

Sidebar

Related Questions

I need to create an XML schema that looks something like this: <xs:element name=wrapperElement>
I have a big database and I need to create an uml diagram. The
I need create menu for widget like this https://www.gstatic.com/android/market/com.bugabuga.switcher/ss-320-0-0 . What components are used?
this is my first post here. I need create a feed like facebook with
I need to create a diagram to document a RESTFul API that build, which
I'm strugglying with UML diagrams as I just need to draw diagram to visualize
I am trying to create a UML class diagram and corresponding class definition (in,
I have a problem. I need to create a UML design, but specifying for
Hi im not used to UML but i have to create a Use case
i found XMPP on google (i need create a application IM look like Yahoo

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.