<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>ILOG .NET Visualization Blog &#187; Visual Studio</title>
	<link>http://blogs.ilog.com/netvisu</link>
	<description>Postings from the Visualization .NET Development Team</description>
	<pubDate>Fri, 28 Nov 2008 13:39:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
	<language>en</language>
			<item>
		<title>Selected User Meeting Presentations: A (French) Film Festival</title>
		<link>http://blogs.ilog.com/netvisu/2008/08/25/selected-user-meeting-presentations-a-french-film-festival/</link>
		<comments>http://blogs.ilog.com/netvisu/2008/08/25/selected-user-meeting-presentations-a-french-film-festival/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 08:19:51 +0000</pubDate>
		<dc:creator>Emmanuel Tissandier</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Ajax]]></category>

		<category><![CDATA[Diagram]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[Adobe]]></category>

		<category><![CDATA[Diagrammer for .NET]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blogs.ilog.com/netvisu/2008/08/25/selected-user-meeting-presentations-a-french-film-festival/</guid>
		<description><![CDATA[Ed Kiraly has posted in the JViews blog a <a href="http://blogs.ilog.com/jviews/2008/08/22/selected-user-meeting-presentations-a-french-film-festival/">series of videos </a>recorded during a user group meeting in Paris. The recorded sessions (in French) are from our CEO, from the Visualization product team and from Microsoft and Adobe. You will find here a&#8230;]]></description>
			<content:encoded><![CDATA[<p>Ed Kiraly has posted in the JViews blog a <a href="http://blogs.ilog.com/jviews/2008/08/22/selected-user-meeting-presentations-a-french-film-festival/">series of videos </a>recorded during a user group meeting in Paris. The recorded sessions (in French) are from our CEO, from the Visualization product team and from Microsoft and Adobe. You will find here a video showing how a easily create a graph display using WPF and Diagrammer for .NET.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.ilog.com/netvisu/2008/08/25/selected-user-meeting-presentations-a-french-film-festival/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Diagrammer .NET Tips and Tricks Explained Through the “UML Class Diagram” Sample - Part 3</title>
		<link>http://blogs.ilog.com/netvisu/2008/08/06/diagrammer-net-tips-and-tricks-explained-through-the-%e2%80%9cuml-class-diagram%e2%80%9d-sample-part-3/</link>
		<comments>http://blogs.ilog.com/netvisu/2008/08/06/diagrammer-net-tips-and-tricks-explained-through-the-%e2%80%9cuml-class-diagram%e2%80%9d-sample-part-3/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 15:09:51 +0000</pubDate>
		<dc:creator>Eric Durocher</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Diagram]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[scrollable list]]></category>

		<category><![CDATA[UML class diagram]]></category>

		<guid isPermaLink="false">http://blogs.ilog.com/netvisu/2008/08/06/diagrammer-net-tips-and-tricks-explained-through-the-%e2%80%9cuml-class-diagram%e2%80%9d-sample-part-3/</guid>
		<description><![CDATA[
<h3>Creating a Scrollable List</h3>
In <a href="http://blogs.ilog.com/netvisu/2008/04/25/diagrammer-net-tips-and-tricks-explained-through-the-uml-class-diagram-sample/">part 1</a> and <a href="http://blogs.ilog.com/netvisu/2008/05/19/diagrammer-net-tips-and-tricks-explained-through-the-uml-class-diagram-sample-part-2/">part 2</a> of this series, we explained some common techniques for creating complex ILOG Diagrammer for .NET user symbols, and we used a UMLType symbol as an example.

This post will focus on the description&#8230;]]></description>
			<content:encoded><![CDATA[<h3>Creating a Scrollable List</h3>
<p>In <a href="http://blogs.ilog.com/netvisu/2008/04/25/diagrammer-net-tips-and-tricks-explained-through-the-uml-class-diagram-sample/">part 1</a> and <a href="http://blogs.ilog.com/netvisu/2008/05/19/diagrammer-net-tips-and-tricks-explained-through-the-uml-class-diagram-sample-part-2/">part 2</a> of this series, we explained some common techniques for creating complex ILOG Diagrammer for .NET user symbols, and we used a UMLType symbol as an example.</p>
<p>This post will focus on the description of the List user symbol that is used to display the attributes and operations of the UML type. This List symbol is pretty general, and could be reused in other situations.</p>
<p>You can look at the same <a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/04/umlclassdiagram2.zip" title="source code (2)">source code</a> as in the previous post to follow the explanations, since the List symbol was already there.</p>
<p>Here are the graphic elements of the List symbol:</p>
<p><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/08/listsymbol.png" title="listsymbol.png"><img src="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/08/listsymbol.png" alt="listsymbol.png" /></a></p>
<p>The symbol is made of a DockPanel that contains a StackPanel (which will in turn contain the list items), and three groups of graphic objects that make up a scrollbar (the &#8216;up&#8217; button, the thumb and the &#8216;down&#8217; button). We do not want to use a predefined ILOG Diagrammer for .NET VScrollBar object here because it is a little too big for including it in our UMLType symbol.</p>
<p>Let&#8217;s look at the code to see how the List symbol works. First, we need a property to add items to the list:</p>
<pre>        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public Collection&lt;GraphicObject&gt; Items
        {
            get
            {
                return stacker.Objects;
            }
        }</pre>
<p>The Items property just returns the Objects property of the nested StackPanel, so the items of the list will be added directly to the stacker. Note the DesignerSerializationVisibility attribute that makes sure the items will be serialized even though the collection property itself is read-only.</p>
<p>Now, we want our list to be scrollable (vertically only to keep it simple). For this, we add another property that will define the scroll position:</p>
<pre>        [DefaultValue(0)]
        public int ScrollPosition
        {
            get
            {
                return scrollPosition;
            }
            set
            {
                if (value != scrollPosition)
                {
                    scrollPosition = value;
                    InvalidateLayout();
                }
            }
        }</pre>
<p>The ScrollPosition is an integer, as it specifies a number of items (not a position in pixels): this is simpler since we always want to scroll one whole item at a time.</p>
<p>As you can see, the ScrollPosition does not do much by itself, it just sets an internal member variable to the specified value and calls InvalidateLayout(). The idea is to use the built-in layout mechanism of Diagrammer for .NET to really do the scrolling. The InvalidateLayout() call tells Diagrammer for .NET to call the DoLayout() method of our symbol just before the symbol is next painted on the screen. This makes sure that the scrolling logic will not be executed several times unnecessarily.The DoLayout() method is overridden as follows:</p>
<pre>        protected override void DoLayout()
        {
            dockPanel1.SuspendLayout();
            Rectangle2D bounds = new Rectangle2D(0, 0, Rectangle.Width, dockPanel1.Height);
            stacker.Bounds = bounds;
            stacker.PerformLayout();
            if (Items.Count != 0)
            {
                int pos = scrollPosition;
                if (pos &gt;= Items.Count)
                    pos = Items.Count - 1;
                if (pos &lt; 0)
                    pos = 0;
                bounds.Y = -Items[pos].Y;
                stacker.Bounds = bounds;
            }
            dockPanel1.ResumeLayout(true);
            UpdateArrows();
        }</pre>
<p>What we do here is to move and resize the StackPanel that contains the items according to the ScrollPosition property and to the size of the List symbol. Basically, the top of the stacker is shifted vertically so that the item whose index is ScrollPosition is just at the top of the list. Note the SuspendLayout()/ResumeLayout() calls on the DockPanel that make sure that the parent&#8217;s layout is re-computed only once during this process. Finally, a method called UpdateArrows() is called: it enables or disables the up/down arrows according to the scroll position.</p>
<p>Let&#8217;s talks about the scrollbar now. The idea is simple: the &#8216;up&#8217; bottom will decrease the ScrollPosition by 1, the &#8216;down&#8217; button will increase it, and the thumb will modify the ScrollPosition proportionally to the move.If you look at the code,you will see that it is actually more complex than that:</p>
<ul>
<li> We added timers so that, when you keep the left mouse button pressed in the &#8216;up&#8217; or &#8216;down&#8217; arrows, the list continues to scroll.</li>
<li>We must &#8216;capture&#8217; the mouse to make sure that, when we click in the thumb for instance, the mouse events will continue to move the thumb even if the mouse is not over it any more.</li>
</ul>
<p>Just a final word: as it is, the List symbol is good enough as an element of the UMLType symbol, but it would need a little more polishing before it can be used as a standalone, general list object. In particular, it should behave as a container when it is used in the Visual Studio designer: see <a href="http://blogs.ilog.com/netvisu/2008/07/30/how-to-create-a-user-symbol-that-acts-as-a-container/">this other post</a> that explains how to do this.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.ilog.com/netvisu/2008/08/06/diagrammer-net-tips-and-tricks-explained-through-the-%e2%80%9cuml-class-diagram%e2%80%9d-sample-part-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Adding Smart Tags support to custom User Symbol</title>
		<link>http://blogs.ilog.com/netvisu/2008/07/22/adding-smart-tags-support-to-custom-user-symbol/</link>
		<comments>http://blogs.ilog.com/netvisu/2008/07/22/adding-smart-tags-support-to-custom-user-symbol/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 16:06:39 +0000</pubDate>
		<dc:creator>Patrick Ruzand</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Diagram]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://blogs.ilog.com/netvisu/2008/07/22/adding-smart-tags-support-to-custom-user-symbol/</guid>
		<description><![CDATA[<a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umltypesmarttags2.png" title="Smart Tags part 2"></a><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umltypesmarttags.png" title="SmartTags in User Symbol"></a><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/winformssmarttag.png" title="winformssmarttag.png"></a><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/gosmarttags.png" title="gosmarttags.png"></a>In the previous "Diagrammer Tips and Tricks" series (see <a target="_blank" href="http://blogs.ilog.com/netvisu/2008/04/25/diagrammer-net-tips-and-tricks-explained-through-the-uml-class-diagram-sample/" title="Tips and tricks part 1">Part 1</a> and <a target="_blank" href="http://blogs.ilog.com/netvisu/2008/05/19/diagrammer-net-tips-and-tricks-explained-through-the-uml-class-diagram-sample-part-2/" title="Tips and Tricks part 2">Part 2</a>), you have learnt how to create a user symbol and how to define design-time capabilities. In this new article, we will explain how to enable Smart Tags&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umltypesmarttags2.png" title="Smart Tags part 2"></a><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umltypesmarttags.png" title="SmartTags in User Symbol"></a><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/winformssmarttag.png" title="winformssmarttag.png"></a><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/gosmarttags.png" title="gosmarttags.png"></a>In the previous &#8220;Diagrammer Tips and Tricks&#8221; series (see <a target="_blank" href="http://blogs.ilog.com/netvisu/2008/04/25/diagrammer-net-tips-and-tricks-explained-through-the-uml-class-diagram-sample/" title="Tips and tricks part 1">Part 1</a> and <a target="_blank" href="http://blogs.ilog.com/netvisu/2008/05/19/diagrammer-net-tips-and-tricks-explained-through-the-uml-class-diagram-sample-part-2/" title="Tips and Tricks part 2">Part 2</a>), you have learnt how to create a user symbol and how to define design-time capabilities. In this new article, we will explain how to enable Smart Tags on your custom User Symbol.</p>
<p><strong>Note:</strong> this article requires the ILOG Diagrammer for .NET Patch 14 available on the <a target="_blank" href="https://support.ilog.com/" title="ILOG Support">ILOG Diagrammer for .NET support site</a>.</p>
<h2>What are Smart Tags</h2>
<p>In short, Smart Tags are shortcuts for PropertySheet items accessible from the Visual Studio Design surface and specific to the current selected item. They are natively supported in the Visual Studio WinForms designer through the little arrow icon located at the top-right corner of the current selected object. Clicking on this icon pops up a menu (the Smart Tags panel) populated with items (the Smart Tags items). These items expose a reduced set of design-time configuration entries like properties or verbs (a verb describes a specific action to perform accessible from the PropertySheet). The following image shows the ListBox Smart Tags panel :</p>
<p><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/winformssmarttag.png" title="winformssmarttag.png"><img src="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/winformssmarttag.png" alt="winformssmarttag.png" /></a></p>
<p>In Visual Studio, <a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umltypesmarttags1.png" title="Smart Tags - Step 1"></a>Smart Tags are exposed by means of <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.design.designeractionitem.aspx"><strong>DesignerActionItem</strong> </a>instances. A <strong>DesignerActionItem</strong> defines the action to perform when the item is activated. It can be a simple property setter like what the Property Sheet provides, or a more advanced action handled through a method invocation. DesignerActionItem&#8217;s are accessible from the component&#8217;s <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.design.componentdesigner.aspx"><strong>ComponentDesigner</strong> </a>through its <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.design.designeractionlist.aspx"><strong>DesignerActionList</strong></a>. When a component is selected, the Design environment asks the component designer for its <strong>DesignerActionList</strong> and populates the Smart Tags panel with the DesignerActionItem&#8217;s.</p>
<h2>Smart Tags in ILOG Diagrammer for .NET</h2>
<p>ILOG Diagrammer for .NET extends the Smart Tags support to <strong>GraphicObject</strong> instances, which means that you can define Smart Tags the same way you do in a WinForms custom control. For example, the following pictures shows the Smart Tags items of a <strong>ClosedCurve</strong> :</p>
<p><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/gosmarttags.png" title="gosmarttags.png"><img src="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/gosmarttags.png" alt="gosmarttags.png" /></a></p>
<p>To illustrate the article, we will use the <strong>UMLType</strong> user symbol described in the &#8220;Diagrammer Tips and Tricks&#8221; series and the following <a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umlclassdiagram.zip" title="Smart Tags Support - VS2008 Project File">VS2008 Project</a>.</p>
<p>As for a WinForms control, adding support for Smart Tags to an ILOG Diagrammer for .NET <strong>UserSymbol</strong> first requires a <strong>ComponentDesigner</strong> associated with the UserSymbol. For <strong>GraphicObject</strong> instances, the ILOG Diagrammer for .NET framework provides the <strong>GraphicObjectDesigner</strong> class that provides a set of services for <strong>GraphicObject</strong> design-time support. It is the base class we inherit from to implement our <strong>UMLType</strong> designer.</p>
<p>We then need to define the action items we want to add to the Smart Tag panel. For the <strong>UMLType</strong> user symbol, the TypeName, Attributes and Operations properties are good candidates. To show the different kind of possible action items, the TypeName property (which is of type <strong>String</strong>) will be exposed in the Smart Tags panel as a standard property in the same way it is exposed in a Property Sheet (that is as a description-textbox pair). The two others (which are specialized Collection) will be exposed as Verbs, which on the UI side are similar to hyperlinks that perform some actions (in our case, it pops up the Collection editor).</p>
<p>In term of implementation, it translates into the following steps :</p>
<ul>
<li>subclass <strong>DesignerActionList</strong></li>
<li>override the <strong><a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.design.designeractionlist.getsortedactionitems.aspx">GetSortedActionItems()</a></strong> method to populate the list with the action items.</li>
<li>handles the actions corresponding to the action items.</li>
<li>Subclass <strong>GraphicObjectDesigner</strong></li>
<li>override the <strong>CreateActionList</strong> method to return an instance of the <strong>DesignerActionList</strong> subclass.</li>
</ul>
<h2>Implementing the DesignerActionList</h2>
<p>The purpose of a <strong>DesignerActionList</strong> is to provide a list of Smart Tags items to the user symbol designer and to handle the action defined by the items. Populating the list of Smart Tags items is the purpose of the <strong>DesignerActionList.GetSortedActionItems()</strong> method which should be overriden to return the items that apply to the component. Let&#8217;s start with the TypeName property we want to expose since it is the simplest Smart Tags item type.</p>
<p>A property Smart Tags item is defined by the <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.design.designeractionpropertyitem.aspx"><strong>DesignerActionPropertyItem</strong> </a>class in the System.ComponentModel.Design namespace. This class easily allows to expose a property in the Smart Tags panel so that it can be edited in-place. The constructor signature is defined as:</p>
<pre>
public DesignerActionPropertyItem(
    string memberName,
    string displayName,
    string category,
    string description)</pre>
<p>The most important parameter is the <em>memberName</em> argument, which refers to the associated property <u>of the <strong>DesignerActionList</strong> subclass</u>. It means that the <strong>UMLType</strong> TypeName property must be duplicated on the <strong>DesignerActionList</strong> as a facade to the underlying <strong>UMLType</strong> component. Here is a first draft of the <strong>UMLTypeActionList</strong> implementation:</p>
<pre>
    class UMLTypeActionList : DesignerActionList {
        public UMLTypeActionList(IComponent component)
            : base(component) {
        }          

        public string TypeName {
            get { return ((UMLType)Component).TypeName; }
            set { UMLTypeDesigner.SetProperty(GetService(typeof(IDesignerHost)) as IDesignerHost,
                                              Component,
                                              value,
                                              "TypeName",
                                              "The name of the UML type.");
            }
        }          

        public override DesignerActionItemCollection GetSortedActionItems() {
            DesignerActionItemCollection items = new DesignerActionItemCollection();
            // The "TypeName" property
            items.Add(new DesignerActionPropertyItem("TypeName",
                                                     "Type name",
                                                     "UML",
                                                     "The name of the UML type."));
            return items;
        }
    }</pre>
<p>In the code above, the TypeName property setter invokes the <strong>UMLTypeDesigner.SetProperty</strong> method, which is a convenient method allowing to perform an undoable property setting.</p>
<p>In order to be able to test our action list implementation, we need to implement the <strong>UMLType</strong> designer and associate it with the UMLType component so that the Design-time API supports it. As mentioned above, the <strong>UMLType</strong> designer inherits from the <strong>GraphicObjectDesigner</strong> class and in this simple use case, the only method we need to override is the <strong>CreateActionList()</strong> factory method that returns an instance of the <strong>UMLTypeActionList</strong> class. Here is the implementation:</p>
<pre>
    public class UMLTypeDesigner : GraphicObjectDesigner {
        protected override System.ComponentModel.Design.DesignerActionList CreateActionList() {
            return new UMLTypeActionList(this.Component);
        }
    }</pre>
<p>Finally, the last step is to associate this designer class to the <strong>UMLType</strong> class by means of the <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.designerattribute.aspx"><strong>DesignerAttribute</strong> </a>class attribute:</p>
<pre>
    [Designer(typeof(UMLTypeDesigner), typeof(IDesigner))]
    public partial class UMLType : UserSymbol
    {
      ...
    }</pre>
<p>Running the sample at this stage gives the following result (after having added our assembly to the Visual Studio Toolbox while in diagram editing mode) :</p>
<p> <a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umltypesmarttags1.png" title="Smart Tags - Step 1"><img src="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umltypesmarttags1.png" alt="Smart Tags - Step 1" /></a></p>
<p>Ok. But what about use cases where you need more than just editing a property value ? For example, you may need to define complex actions like defining a data binding-like wizard-driven process that can be started from the Smart Tags panel. To address these use cases, the design-time API provides the <strong>DesignerActionMethodItem</strong> class which instead of relying on a property invokes a specified method that will handle the action. This is what we are going to use for the Operations and Attributes UMLType members. Instead of being exposed as a Property action item, they will be displayed as an &#8220;HyperLink&#8221;. When clicked, a modal dialog displaying the associated <strong>UITypeEditor</strong> (here the standard collection editor) will be shown.</p>
<h2>Invoking the UITypeEditor from a Smart Tags item.</h2>
<p>In the WinForms design-time API documentation, a <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.drawing.design.uitypeeditor.aspx"><strong>UITypeEditor</strong> </a>is defined as an editor &#8220;that can provide a user interface for representing and editing the values of objects of the supported data types&#8221;. In the sample we are writing, we will use the <strong>UITypeEditor</strong> associated with the Operations and Attributes properties and invoke its <strong>EditValue()</strong> method to edit the object&#8217;s value. Typical <strong>UITypeEditor</strong> implementations are meant to work with a PropertyGrid component, and as such are (in most cases) expecting an <strong><a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.windows.forms.design.iwindowsformseditorservice.aspx">IWindowsFormsEditorService</a></strong>, as explains the Microsoft documentation (&#8221;This service is typically used to display a form from the EditValue method of a UITypeEditor&#8221;). Since a <strong>IWindowsFormsEditorService</strong> instance is available only from the PropertyGrid control, we have to write our own implementation. Let&#8217;s name it <strong>EditorService</strong>, and for convenient reasons, it will also implements the <strong>ITypeDescriptorContext</strong> and the ServiceProvider interfaces since the <strong>UITypeEditor.EditValue</strong> method expects such services.</p>
<p>As previously mentioned, the corresponding Attributes or Operations <strong>DesignerActionMethodItem</strong>&#8217;s should display a modal dialog holding the associated <strong>UITypeEditor</strong> (the CollectionEditor in this case). For this purpose, our <strong>IWindowsFormsEditorService</strong> implementation (the <strong>EditorService</strong> class) must implement the <strong>ShowDialog(Form dialog)</strong> method to basically invoke the <strong>Form.ShowDialog</strong> method on the <em>dialog</em> parameter. This method allows to specify the dialog owner via the owner&#8217;s Win32 HWND. In our case, the dialog owner to specify is simply the Smart Tags window that is exposed in the ILOG Diagrammer for .NET library by means of the <strong>ILOG.Diagrammer.Design.IDropDownOwner</strong> interface (introduced in patch 14). This interface is implemented by the DesignerHost RootComponent&#8217;s designer and represents a possible candidate for dialog ownership.</p>
<p>While it may appear quite complex, the following piece of code will clear up everything:</p>
<pre>
        DialogResult IWindowsFormsEditorService.ShowDialog(Form dialog) {
            IDesignerHost host =
              (IDesignerHost)((IServiceProvider)this).GetService(typeof(IDesignerHost));
            IDropDownOwner rootDesigner = null;
            if (host != null)
                rootDesigner = host.GetDesigner(host.RootComponent) as IDropDownOwner;
            if (rootDesigner == null) {
                IUIService srv =
                  (IUIService)((IServiceProvider)this).GetService(typeof(IUIService));
                if (srv != null)
                    return srv.ShowDialog(dialog);
            }
            if (rootDesigner != null) {
                IWin32Window owner = rootDesigner.DropDownOwner;
                if (owner != null)
                    return dialog.ShowDialog(owner);
            }
            return dialog.ShowDialog(_component as IWin32Window);
        }</pre>
<p>The implementation first retrieves the <strong><a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.design.idesignerhost.aspx">IDesignerHost</a></strong>, then tries to get the RootComponent&#8217;s designer as a <strong>IDropDownOwner</strong>. Then, if successful, it invokes dialog.ShowDialog() method passing the Smart Tags window HWND as the dialog owner (the return value of rootDesigner.DropDownOwner).</p>
<p>So, with this EditorService class, we now have everything we need to write the Attributes and Operations <strong>DesignerActionMethodItem</strong> instances.</p>
<p>The DesignerActionMethodItem constructor is defined as:</p>
<pre>
public DesignerActionMethodItem(
    DesignerActionList actionList,
    string memberName,
    string displayName,
    string category,
    string description,
    bool includeAsDesignerVerb
)</pre>
<p>where <em>memberName</em> specifies the method to invoke <u>on the DesignerActionList instance</u>.</p>
<p>The following code shows the implementation corresponding to the Attributes property (you can refer to the full source code for the Operations property and the complete <strong>EditorService</strong> implementation).</p>
<pre>
    class UMLTypeActionList : DesignerActionList {
        ...
        public void EditAttributes() {
            EditorService.EditValue(Component.Site, Component, "Attributes");
        }
        public override DesignerActionItemCollection GetSortedActionItems() {
            DesignerActionItemCollection items =
                new DesignerActionItemCollection();
            // The "TypeName" property
            ...
            // The 'Edit Attributes...' verb
            items.Add(new DesignerActionMethodItem(this,
                                    "EditAttributes",
                                    "Edit Attributes...",
                                    "UML",
                                    "The attributes of the UML type.",
                                    true));
        }
    }</pre>
<p>And here is the final result:</p>
<p><a href="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umltypesmarttags2.png" title="Smart Tags part 2"><img src="http://blogs.ilog.com/netvisu/wp-content/uploads/2008/07/umltypesmarttags2.png" alt="Smart Tags part 2" /></a></p>
<p>In this article, we have seen how to support Smart Tags from a custom ILOG Diagrammer for .NET User Symbol. Using the same design-time API as the Windows Forms controls, it integrates seamlessly with the Visual Studio design surface and greatly improves the user experience of your symbols.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.ilog.com/netvisu/2008/07/22/adding-smart-tags-support-to-custom-user-symbol/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Creating a Nice Diagram Display with WPF :  It&#8217;s So Easy</title>
		<link>http://blogs.ilog.com/netvisu/2008/06/18/creating-a-nice-diagram-display-with-wpf-its-so-easy/</link>
		<comments>http://blogs.ilog.com/netvisu/2008/06/18/creating-a-nice-diagram-display-with-wpf-its-so-easy/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 20:26:23 +0000</pubDate>
		<dc:creator>Ed Kiraly</dc:creator>
		
		<category><![CDATA[Diagram]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://blogs.ilog.com/netvisu/2008/06/18/creating-a-nice-diagram-display-with-wpf-its-so-easy/</guid>
		<description><![CDATA[In this short 7 minute presentation, Patrick Megard leads us through the basic steps in creating a diagram display using ILOG Diagrammer for .NET's and Visual Studio 2008's WPF features.

<em>The following movie is best viewed in full screen mode:</em>
<p align="center">&#160;</p>
<em>Presented&#8230;</em>]]></description>
			<content:encoded><![CDATA[<p>In this short 7 minute presentation, Patrick Megard leads us through the basic steps in creating a diagram display using ILOG Diagrammer for .NET&#8217;s and Visual Studio 2008&#8217;s WPF features.</p>
<p><em>The following movie is best viewed in full screen mode:</em></p>
<p align="center">&nbsp;</p>
<p><embed enablejs="true" overstretch="true" allowfullscreen="true" allowscriptaccess="always" flashvars="file=http://visudemos.ilog.com/videos/WPFandD4NET.flv&amp;displayheight=360" height="360" width="522" src="http://visudemos.ilog.com/videos/mediaplayer.swf" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed><em>Presented by Patrick Megard.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.ilog.com/netvisu/2008/06/18/creating-a-nice-diagram-display-with-wpf-its-so-easy/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
