2

For some of my activities, I would prefer to have it completely collapsed to just show the title bar when the users collapses its designer. By default, if you are using the standard way of a collapsible designer (with datatrigger on ShowExpanded), you still get an empty white rectangle under the title bar - at least on Win7 with .NET 4.0.3

Screenshot

I would like to have it displayed just as the Delay activity shown above, without any box underneath the title.

It seems to me that this annoying white box is caused by the default template defined in resource WorkflowElementDesignerDefaultTemplate which has a ContentPresenter with Margin="7":

                <ContentPresenter  x:Uid="ContentPresenter_1" Margin="7" Content="{Binding Path=Content, RelativeSource={RelativeSource AncestorType={x:Type swd:WorkflowViewElement}}}" Grid.Row="1">
                <ContentPresenter.Style>
                    <Style x:Uid="Style_10">
                        <Setter x:Uid="Setter_204" Property="ContentPresenter.Visibility" Value="Visible" />
                        <Style.Triggers>
                            <DataTrigger x:Uid="DataTrigger_237" Binding="{Binding Path=Content, RelativeSource={RelativeSource AncestorType={x:Type swd:WorkflowViewElement}}}" Value="{x:Null}">
                                <Setter x:Uid="Setter_213" Property="ContentPresenter.Visibility" Value="Collapsed" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </ContentPresenter.Style>
            </ContentPresenter>

So, even when the contained stuff that we define in our activity designer XAML gets completely collapsed, this margin of 7 still shows up.

Is there any way to avoid it? Setting the margin to 0 (or even better, triggering Visibility=Collapsed for the containing ContentPresenter from the default template) when the designer is to be shown as collapsed?

(I hope that was not too confusing?)

Achim
  • 828
  • 6
  • 21
  • Did you solve this issue? – Uriil Mar 23 '15 at 09:04
  • Unfortunately no. I created some custom designers with a completely new template that have a non-rectangular shape, but simply having the titlebar without any free space below seems to be impossible??? – Achim Mar 23 '15 at 12:35

1 Answers1

0

From your snippet I can't tell exactly what you're doing.

Anyway, check this designer.

Basically you've to have two <DataTemplate>, one for collapsed mode and other for expanded mode. The link's example is self-explanatory I guess.

Joao
  • 7,366
  • 4
  • 32
  • 48
  • No, that's not the problem. The basic collapse/expand works just fine with my designer, I did it exactly as described in Ron's article. What I'm after is hiding that white rectangle that is still there when collapsed mode is on, see the screenshot in original question. The snippet included is NOT my code, it's from .NET WF4 default template. – Achim Apr 14 '13 at 11:52