Share via


Özel Bileşik Tasarımcılar - İş Akışı Öğesi Sunucu

WorkflowItemPresenter, rastgele bir etkinliğin yerleştirilebildiği bir "bırakma bölgesi" oluşturulmasına olanak tanıyan WF tasarımcısı programlama modelindeki bir anahtar türüdür. Bu örnek, "bırakma bölgesi" gibi bir etkinlik tasarımcısının nasıl derlendiğini gösterir.

WorkflowItemPresenter örneği aşağıdakileri gösterir:

  • ile WorkflowItemPresenterözel etkinlik tasarımcısı oluşturma.

  • Meta veri depoyu kullanarak özel tasarımcıyı kaydetme.

  • Yeniden barındırılan araç kutusunu bildirimli ve kesin olarak programlama.

Örnek Ayrıntılar

Bu örneğin kodu şunları gösterir:

  • Özel etkinlik tasarımcısı sınıfı için SimpleNativeActivity oluşturulur.

  • ile WorkflowItemPresenterözel etkinlik tasarımcısı oluşturma.

<sap:ActivityDesigner x:Class="Microsoft.Samples.UsingWorkflowItemPresenter.SimpleNativeDesigner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation">
    <sap:ActivityDesigner.Resources>
        <DataTemplate x:Key="Collapsed">
            <StackPanel>
                <TextBlock>This is the collapsed view</TextBlock>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="Expanded">
            <StackPanel>
                <TextBlock>Custom Text</TextBlock>
                <sap:WorkflowItemPresenter Item="{Binding Path=ModelItem.Body, Mode=TwoWay}"
                                        HintText="Please drop an activity here" />
            </StackPanel>
        </DataTemplate>
        <Style x:Key="ExpandOrCollapsedStyle" TargetType="{x:Type ContentPresenter}">
            <Setter Property="ContentTemplate" Value="{DynamicResource Collapsed}"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=ShowExpanded}" Value="true">
                    <Setter Property="ContentTemplate" Value="{DynamicResource Expanded}"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </sap:ActivityDesigner.Resources>
    <Grid>
        <ContentPresenter Style="{DynamicResource ExpandOrCollapsedStyle}" Content="{Binding}" />
    </Grid>
</sap:ActivityDesigner>

bağlamak için WPF veri bağlamasının kullanımına dikkat edin ModelItem.Body. ModelItem, tasarımcının kullanılmakta olduğu temel nesneye başvuran özelliğidirActivityDesigner( bu örnekte SimpleNativeActivity).

Örneği ayarlama, derleme ve çalıştırma

  1. çözümünü Visual Studio’da açın.

  2. Uygulamayı derlemek ve çalıştırmak için F5 tuşuna basın.

Ayrıca bkz.