locked
ActivityDesignerTheme introuvable

    질문

  • j'ai trouvé ce code sur le forum anglais mais je n'arrive pas à l'utiliser car Visual Studio ne trouve pas ActivityDesignerTheme

      [ActivityDesignerThemeAttribute(typeof(RunDesignerTheme))]
      internal class RunDesigner : ActivityDesigner
    	{
    	}
    
      internal class RunDesignerTheme : ActivityDesignerTheme
      {
        public RunDesignerTheme(WorkflowTheme theme)
          : base(theme)
        {
          this.BackColorStart = Color.Black;
          this.BackColorEnd = Color.Gray;
          this.ForeColor = Color.White;
          this.BackgroundStyle = System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal;
          this.BorderColor = Color.White;
        }
      }
    

    2010년 9월 3일 금요일 오전 8:06

답변

  • Bonjour Apeb,

    Vos dernières questions reposant sur Workflow Foundation 4 (WF4), je suppose que vous utilisez ce code aussi sur WF4. Malheureusement, l’ActivityDesignerTheme est une class de WF3. Elle n’existe plus dans WF4.


    Ps : hironi du sort, je crois bien que ce code est de moi. Je l’ai posté récemment sur le forum US pour un utilisateur de WF3 ;)


    Jérémy Jeanson MCP, MCTS http://blogs.codes-sources.com/JeremyJeanson/ (French or English spoken)
    • 답변으로 제안됨 JeremyJeansonMVP, Moderator 2010년 9월 3일 금요일 오전 8:18
    • 답변으로 표시됨 Apeb 2010년 9월 3일 금요일 오전 9:02
    2010년 9월 3일 금요일 오전 8:18
  • Re,

    je vous conseil d'utiliser un dictionnaire de styles WPF comme je l'ai présenté dans cet article :

    http://blogs.codes-sources.com/jeremyjeanson/archive/2010/08/27/wf4-rendre-une-activit-plus-sexy-avec-wpf.aspx

    Les style sont présent dans ce dictionnaire :

    <ResourceDictionary 
     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">
    
      <!-- BackGround de la zone des activités -->
      <SolidColorBrush x:Key="BackGround" Color="White" />
      
      <!-- Style des TextBlock -->
      <Style TargetType="{x:Type TextBlock}">
        <Style.Setters>
          <Setter Property="Margin" Value="0 0 5 0" />
          <Setter Property="VerticalAlignment" Value="Center" />
        </Style.Setters>
      </Style>
      
      <!-- Style des Border -->
      <Style x:Key="BorderStyle" TargetType="{x:Type Border}">
        <Style.Setters>
          <Setter Property="BorderBrush" Value="LightGray" />
          <Setter Property="BorderThickness" Value="1" />
          <Setter Property="Background" Value="White" />
          <Setter Property="Padding" Value="5" />
        </Style.Setters>
      </Style>
    
      <!-- Style des Commentaires -->
      <Style x:Key="CommentStyle" TargetType="{x:Type TextBlock}">
        <Style.Setters>
          <Setter Property="FontStyle" Value="Italic" />
          <Setter Property="TextAlignment" Value="Center" />
          <Setter Property="HorizontalAlignment" Value="Center" />
          <Setter Property="VerticalAlignment" Value="Center" />
        </Style.Setters>
      </Style>
    
      <!-- Style des WorkflowItemPresenter -->
      <Style TargetType="{x:Type sap:WorkflowItemPresenter}" >
        <Style.Setters>
          <Setter Property="HintText" Value="Glissez une activité ici ..." />
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type sap:WorkflowItemPresenter}">
                <Border Style="{StaticResource ResourceKey=BorderStyle}">
                  <ContentPresenter />
                </Border>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style.Setters>
      </Style>
      
      <!-- Style des WorkflowItemsPresenter -->
      <Style TargetType="{x:Type sap:WorkflowItemsPresenter}">
        <Style.Setters>
          <Setter Property="HintText" Value="Glissez vos activités ici ..." />
          <Setter Property="ItemsPanel">
            <Setter.Value>
              <ItemsPanelTemplate>
                <!-- Oriantation des activités (de haut en bas) -->
                <StackPanel Orientation="Vertical" />
              </ItemsPanelTemplate>
            </Setter.Value>
          </Setter>
          <Setter Property="SpacerTemplate">
            <Setter.Value>
              <DataTemplate>
                <!-- 
                 StackPanel utilisé pour étandre la zone de drag and drop d'activité
                 au dela du simple Polygon
                 -->
                <StackPanel Background="{StaticResource ResourceKey=BackGround}">
                  <Polygon HorizontalAlignment="Center" Margin="5" Fill="White" Stroke="Gray" Points="0,0 16,0 8,8" />
                </StackPanel>
              </DataTemplate>
            </Setter.Value>
          </Setter>
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type sap:WorkflowItemsPresenter}">
                <Border Style="{StaticResource ResourceKey=BorderStyle}">
                  <ContentPresenter />
                </Border>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style.Setters>
      </Style>
    </ResourceDictionary>
    

    Et s'appliquent à toutes mes activités via ce code qui se trouve en début d'activityDesigner :

      <sap:ActivityDesigner.Resources>
        <ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/WHSActivities.Design;component/Themes/Generic.xaml"/>
          </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
      </sap:ActivityDesigner.Resources>
    

    Voila ;)


    Jérémy Jeanson MCP, MCTS http://blogs.codes-sources.com/JeremyJeanson/ (French or English spoken)
    • 답변으로 제안됨 JeremyJeansonMVP, Moderator 2010년 9월 3일 금요일 오전 8:44
    • 답변으로 표시됨 Apeb 2010년 9월 3일 금요일 오전 9:03
    2010년 9월 3일 금요일 오전 8:44

모든 응답

  • Bonjour Apeb,

    Vos dernières questions reposant sur Workflow Foundation 4 (WF4), je suppose que vous utilisez ce code aussi sur WF4. Malheureusement, l’ActivityDesignerTheme est une class de WF3. Elle n’existe plus dans WF4.


    Ps : hironi du sort, je crois bien que ce code est de moi. Je l’ai posté récemment sur le forum US pour un utilisateur de WF3 ;)


    Jérémy Jeanson MCP, MCTS http://blogs.codes-sources.com/JeremyJeanson/ (French or English spoken)
    • 답변으로 제안됨 JeremyJeansonMVP, Moderator 2010년 9월 3일 금요일 오전 8:18
    • 답변으로 표시됨 Apeb 2010년 9월 3일 금요일 오전 9:02
    2010년 9월 3일 금요일 오전 8:18
  • Oui merci, j'utilise WF4.

    Mais je fais comment pour avoir un thème pour toutes mes activité?

    2010년 9월 3일 금요일 오전 8:39
  • Re,

    je vous conseil d'utiliser un dictionnaire de styles WPF comme je l'ai présenté dans cet article :

    http://blogs.codes-sources.com/jeremyjeanson/archive/2010/08/27/wf4-rendre-une-activit-plus-sexy-avec-wpf.aspx

    Les style sont présent dans ce dictionnaire :

    <ResourceDictionary 
     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">
    
      <!-- BackGround de la zone des activités -->
      <SolidColorBrush x:Key="BackGround" Color="White" />
      
      <!-- Style des TextBlock -->
      <Style TargetType="{x:Type TextBlock}">
        <Style.Setters>
          <Setter Property="Margin" Value="0 0 5 0" />
          <Setter Property="VerticalAlignment" Value="Center" />
        </Style.Setters>
      </Style>
      
      <!-- Style des Border -->
      <Style x:Key="BorderStyle" TargetType="{x:Type Border}">
        <Style.Setters>
          <Setter Property="BorderBrush" Value="LightGray" />
          <Setter Property="BorderThickness" Value="1" />
          <Setter Property="Background" Value="White" />
          <Setter Property="Padding" Value="5" />
        </Style.Setters>
      </Style>
    
      <!-- Style des Commentaires -->
      <Style x:Key="CommentStyle" TargetType="{x:Type TextBlock}">
        <Style.Setters>
          <Setter Property="FontStyle" Value="Italic" />
          <Setter Property="TextAlignment" Value="Center" />
          <Setter Property="HorizontalAlignment" Value="Center" />
          <Setter Property="VerticalAlignment" Value="Center" />
        </Style.Setters>
      </Style>
    
      <!-- Style des WorkflowItemPresenter -->
      <Style TargetType="{x:Type sap:WorkflowItemPresenter}" >
        <Style.Setters>
          <Setter Property="HintText" Value="Glissez une activité ici ..." />
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type sap:WorkflowItemPresenter}">
                <Border Style="{StaticResource ResourceKey=BorderStyle}">
                  <ContentPresenter />
                </Border>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style.Setters>
      </Style>
      
      <!-- Style des WorkflowItemsPresenter -->
      <Style TargetType="{x:Type sap:WorkflowItemsPresenter}">
        <Style.Setters>
          <Setter Property="HintText" Value="Glissez vos activités ici ..." />
          <Setter Property="ItemsPanel">
            <Setter.Value>
              <ItemsPanelTemplate>
                <!-- Oriantation des activités (de haut en bas) -->
                <StackPanel Orientation="Vertical" />
              </ItemsPanelTemplate>
            </Setter.Value>
          </Setter>
          <Setter Property="SpacerTemplate">
            <Setter.Value>
              <DataTemplate>
                <!-- 
                 StackPanel utilisé pour étandre la zone de drag and drop d'activité
                 au dela du simple Polygon
                 -->
                <StackPanel Background="{StaticResource ResourceKey=BackGround}">
                  <Polygon HorizontalAlignment="Center" Margin="5" Fill="White" Stroke="Gray" Points="0,0 16,0 8,8" />
                </StackPanel>
              </DataTemplate>
            </Setter.Value>
          </Setter>
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type sap:WorkflowItemsPresenter}">
                <Border Style="{StaticResource ResourceKey=BorderStyle}">
                  <ContentPresenter />
                </Border>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style.Setters>
      </Style>
    </ResourceDictionary>
    

    Et s'appliquent à toutes mes activités via ce code qui se trouve en début d'activityDesigner :

      <sap:ActivityDesigner.Resources>
        <ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/WHSActivities.Design;component/Themes/Generic.xaml"/>
          </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
      </sap:ActivityDesigner.Resources>
    

    Voila ;)


    Jérémy Jeanson MCP, MCTS http://blogs.codes-sources.com/JeremyJeanson/ (French or English spoken)
    • 답변으로 제안됨 JeremyJeansonMVP, Moderator 2010년 9월 3일 금요일 오전 8:44
    • 답변으로 표시됨 Apeb 2010년 9월 3일 금요일 오전 9:03
    2010년 9월 3일 금요일 오전 8:44
  • Merci
    2010년 9월 3일 금요일 오전 9:03
  • De rien,

    Cel fait plasir quand le suivi questions réponses vas aussi vite ;)


    Jérémy Jeanson MCP, MCTS http://blogs.codes-sources.com/JeremyJeanson/ (French or English spoken)
    2010년 9월 3일 금요일 오전 9:05