Building a workflow Designer using Silverlight (20)-adding labels (top)

Source: Internet
Author: User

Source code Download: http://www.shareidea.net/opensource.htm

Online Demo: http://www.shareidea.net/workflow.htm

Video Tutorials: http://www.shareidea.net/video/sharedesigner/sharedesigner.html

Let's talk about the new label feature today.

In the rule, in order to explain the rules, you can add a textblack to the rule class to annotate the rule, as the previous program did, as shown in the following illustration:

However, this annotation has a disadvantage, not manually adjust the position, but only according to the location of the rule automatically set the location of this article, sometimes this automatic location is not where we want to. To solve this problem, we add a "tag" class to the configuration of the workflow, which is separate from the rules and is specifically used to annotate the rules. In addition, this label is only for the display of workflow graphics, does not involve process attributes, because there is no need to do storage to the database method, only the existence of the XML configuration file can be.

20.1 Add Label class

Create a new XAML file in Vs.net, modify the file name to Label.xaml, this class is our tag class, which has two main contents, as follows:

<UserControl x:Class="Shareidea.Web.UI.Control.Workflow.Designer.Label"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
MouseLeftButtonDown="UserControl_MouseLeftButtonDown"
MouseMove="UserControl_MouseMove"
MouseLeftButtonUp="UserControl_MouseLeftButtonUp"
MouseLeave="UserControl_MouseLeave"
Width="400" Height="20">
<Grid x:Name="LayoutRoot"    Background="Transparent" >
<TextBlock Name="txtLabelName"    ></TextBlock>
<TextBox Name="tbLabelName"  TextChanged="TextBox_TextChanged"  Visibility="Collapsed"></TextBox>
</Grid>
</UserControl>

Where TextBlock is used to display the label name and the textbox to edit the label name.

This class has several important attributes:

L support drag and drop layout

L Support Import, export XML information

L Support modifying label names

L support Selection, group move

L Support Paste, copy

L Support Deletion

L SUPPORT the right mouse button menu

This section will specify a few of them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.