Home » Microsoft Technologies

Minimum width for flowchart designer in collapsed state?


This is a followup to this forum question. In the earlier question, I found away to change the appearance of the flowchart designer in its collapsed state by changing the template of the activity designer.  This seems to work pretty well.  The one thing I've noticed is that when I replace the flowchart's template with my own, even if I have a very small width to my template content, there seems to be some minimum width to the selected designer.  That is, if my style looks like this:

<ControlTemplate x:Key="FlowchartDesignerCollapsedTemplate" TargetType="swd:ActivityDesigner">
        <TextBlock Text="Hello, world!"/>

The width of the designer selected area is significantly wider than the width of the characters in 'Hello, world!'.  If I have a border around my text, then my border is much wider than necessary.  If I don't have a border, then when I mouse over or select the activity designer, I see the right selection rectangle much further to the right of my text than I would expect. 

Where is this extra width coming from (it's not in my template) and how can I get rid of it?




5 Answers Found


Answer 1

I tried to adjust the size by changing  the view state  using the ShapeSize and Width keys.  Neither worked, although I noticed  that after I set the ShapeSize to 1,1 when I later looked in the serialized XAML, it got changed to 200, 20 (the Width remained at 1).  I tried also setting a MaxWidth on my root element of template  (e.g. a border) and this did shrink the size down - but the connection rectangle did not observe the MaxWidth, with the right most connection rectangle appearing far to the right of the root element.

I still would like to know what is going on, and how I can work  around the observed behaviour.




Answer 2

maybe you can take a look at



Answer 3

Do you mean the WorkflowElementDesignerDefaultTemplate in Kushal's sample project or something else?  If so, I'm not using Kushal's template  at all.  Having said that, looking at his template, I see the following:

 <Border  x:Uid="ShapeBorder" MinHeight="{TemplateBinding MinHeight}" MinWidth="{TemplateBinding MinWidth}" x:Name="ShapeBorder" CornerRadius="4" >

Border is the root element in his ControlTemplate.  I modified the trigger to set the MinWidth to 0:

           <Style x:Key="FlowchartCollapsedStyle" TargetType="{x:Type swd:ActivityDesigner}">
                    <Trigger Property="ShowExpanded" Value="False">
                        <Setter Property="MinWidth" Value="0"/>
                        <Setter Property="Template" Value="{StaticResource FlowchartDesignerCollapsedTemplate}" />

And that did work!


Answer 4

there is a built in




Answer 5

Ok, thanks.  I'm not sure how I missed it before but MinWidth was what I was looking for and it does work  as advertised.


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure