Use Silverlight to build a workflow designer (21)-Add a tag (bottom)

Source: Internet
Author: User
Source codeDownload: http://www.shareidea.net/opensource.htm

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

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

QQ: 85444465 

Series of indexes in this article:

Using Silverlight to build a workflow designer (1)

Build a workflow designer using Silverlight (2)

Using Silverlight to build a workflow designer (3)

Build a workflow designer using Silverlight (4)

Build a workflow designer using Silverlight (5)

Build a workflow designer using Silverlight (6)

Using Silverlight to build a workflow designer (7)

Using Silverlight to build a workflow designer (8)

Using Silverlight to build a workflow designer (9)

Build a workflow designer using Silverlight (10)

Build a workflow designer using Silverlight (11)

Build a workflow designer using Silverlight (12)

Build a workflow designer using Silverlight (13)

Build a workflow designer using Silverlight (14th)

Build a workflow designer using Silverlight (15th) 

Build a workflow designer using Silverlight (16)

Build a workflow designer using Silverlight (17th)

Build a workflow designer using Silverlight (18)

Build a workflow designer using Silverlight (19th)

Build a workflow designer using Silverlight (20)

As mentioned in the previous section, the tag rename function is supported. The following functions are added in this section:

LSupports selection and group Movement

LSupports Pasting and copying

LDeletion supported

LSupports right-click menu

20.1 Supports selection and group Movement

To support tag selection, implementIsselectdInterface:

 

Code
Public   Bool Isselectd
{
Get
{
Return Isselectd;
}
Set
{
Isselectd = Value;
If (Isselectd)
{
Setselectedcolor ();

If(!_ Container. currentselectedcontrolcollection. Contains (This))
_ Container. addselectedcontrol (This);

}
Else
{
Resetinitcolor ();
}
}

}

 

When you select a tag, update the tag color and add the tag object to the selected object of the current container. When you cancel the selection, reset the tag color, and delete tags from container objects.

To support the movement of tag groupsSetpositionbydisplacementInterface:

 

Code
Public   Void Setpositionbydisplacement ( Double X, Double Y)
{

point P = New point ();
P. x = ( double ) This . getvalue (canvas. leftproperty);
P. Y = ( double ) This . getvalue (canvas. topproperty);

This. Setvalue (canvas. topproperty, P. Y+Y );
This. Setvalue (canvas. leftproperty, p. x+X );

}

 

This interface is used to reset the label position based on the shift.

20.2 Supports Pasting and copying

To support copying, you must implementCloneInterface:

 

Public Label clone ()
{
Label L =   New Label (_ container );
L. labelname =   This . Labelname;
L. Position =   This . Position;
Return L;
}

 

Create a new tag and assign the name and position of the current tag to the new tag.

The paste function is simple, that is, add the copied objects in the memory to the container and display them.

20.3 Deletion supported

ImplementationDeleteThe interface supports deletion. to display the gradient effect during deletion, use oneStoryboardDelete an object after the specified time, as shown below:

 

Code
Public   Void Delete ()
{

If ( ! Isdeleted)
{
Isdeleted =   True ;
Canshowmenu =   False ;
Sbclose. Completed + =   New Eventhandler (sbclose_completed );
Sbclose. Begin ();
}

}20.4Supports context menu

First, you need to addLabelmenu. XAMLFile:

 

Code
< Usercontrol X: Class = "Idea. Web. UI. Control. workflow. Designer. labelmenu"
Xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
Xmlns: x = "Http://schemas.microsoft.com/winfx/2006/xaml"  
Mouseleave = "Usercontrol_mouseleave"
Mouseenter = "Usercontrol_mouseenter" >

< Border Borderbrush = "Black" Borderthickness = "1" >
< Stackpanel >
< Stackpanel. Resources >
< Storyboard X: Name = "Sbshowmenu" >
< Doubleanimation From = "0" To = "50" Duration = "00:00:0. 2"  
Storyboard. targetname = "Spcontentmenu"  
Storyboard. targetproperty = "Height" >
</ Doubleanimation >
</ Storyboard >
< Storyboard X: Name = "Sbclosemenu" >
< Doubleanimation From = "50" To = "0" Duration = "00:00:0. 2"  
Storyboard. targetname = "Spcontentmenu"  
Storyboard. targetproperty = "Height" >
</ Doubleanimation >
</ Storyboard >
</ Stackpanel. Resources >
< Stackpanel Name = "Spcontentmenu" Canvas. zindex = "1000" Canvas. Left = "50" Canvas. Top = "50" Background = "Whitesmoke" >
< Hyperlinkbutton Name = "Btndelete" Foreground = "#000000" Margin = "10 5 15 5" Fontsize = "12" Click = "Deletelabel" Clickmode = "Release" Content = "Deleting tags" > </ Hyperlinkbutton >
< Hyperlinkbutton Name = "Btncopy" Margin = "10 0 15 5" Fontsize = "12" Foreground = "#000000" Click = "Copylabel" Clickmode = "Release" Content = "Copy tags" > </ Hyperlinkbutton >

</Stackpanel>
</Stackpanel>
</Border>
</Usercontrol>

 

The right-click menu has two buttons: delete a tag, copy a tag, and delete and copy the logic above. You only need to call the corresponding method of the tag.

The content of this section is over now. Please leave a message for me if you have any suggestions. Thank you!

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.