2009-09-02 5 views
1

すべてのXAMLウィザードには1つあります。WPFツールキットCalendarコントロール(2009年6月)にはバグがあるようです。このバグは、カレンダーのControlTemplate(具体的にはPART_CalendarItem)を変更すると表示されません。WPFツールキット:バグコントロールテンプレート?

このメッセージの末尾には、Calendarを宣言し、ControlTemplateを割り当てた(ブレンド3.0)ウィンドウ用のXAMLが含まれています。コントロールテンプレートは、CalendarコントロールテンプレートとPART_CalendarItemコントロールのコントロールテンプレート(Blend内)のコピーを編集したCalendarコントロールテンプレートの未修正のコピーです。 XAML(以下コメント「例外」とマーク)のライン78において

VisualStateManager制御のMonthヘッダ上のマウスオーバーにTextColorを割り当てます。ただし、コントロールテンプレートでは、月のボタンではなくMonthボタンを保持するGridにテキストの色が割り当てられます。下のXAMLのように、修正されていないコントロールテンプレートがカレンダーに割り当てられていると、VS2008とBlend 3.0の両方で例外が発生します。

マウスオーバーの強調表示を削除するのではなく、バグを排除するためにコントロールテンプレートを変更する方法を理解できません。私はそれを維持したいと思いますが、TextColorプロパティが対象とするものは表示されません。助言がありますか?ご協力いただきありがとうございます!





XAMLマークアップ


<Window 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:Custom="http://schemas.microsoft.com/wpf/2008/toolkit" 
    x:Class="WpfApplication1.MainWindow" 
    x:Name="Window" 
    Title="MainWindow" 
    Width="640" Height="480"> 
    <Window.Resources> 
     <Style x:Key="CalendarStyle1" TargetType="{x:Type Custom:Calendar}"> 
      <Setter Property="Foreground" Value="#FF333333"/> 
      <Setter Property="Background"> 
       <Setter.Value> 
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> 
         <GradientStop Color="#FFE4EAF0" Offset="0"/> 
         <GradientStop Color="#FFECF0F4" Offset="0.16"/> 
         <GradientStop Color="#FFFCFCFD" Offset="0.16"/> 
         <GradientStop Color="White" Offset="1"/> 
        </LinearGradientBrush> 
       </Setter.Value> 
      </Setter> 
      <Setter Property="BorderBrush"> 
       <Setter.Value> 
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> 
         <GradientStop Color="#FFA3AEB9" Offset="0"/> 
         <GradientStop Color="#FF8399A9" Offset="0.375"/> 
         <GradientStop Color="#FF718597" Offset="0.375"/> 
         <GradientStop Color="#FF617584" Offset="1"/> 
        </LinearGradientBrush> 
       </Setter.Value> 
      </Setter> 
      <Setter Property="BorderThickness" Value="1"/> 
      <Setter Property="Template"> 
       <Setter.Value> 
        <ControlTemplate TargetType="{x:Type Custom:Calendar}"> 
         <StackPanel x:Name="PART_Root" HorizontalAlignment="Center"> 
          <Custom:CalendarItem x:Name="PART_CalendarItem" Style="{DynamicResource CalendarItemStyle1}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/> 
         </StackPanel> 
        </ControlTemplate> 
       </Setter.Value> 
      </Setter> 
     </Style> 
     <Style x:Key="CalendarItemStyle1" TargetType="{x:Type Custom:CalendarItem}"> 
      <Setter Property="Margin" Value="0,3"/> 
      <Setter Property="Template"> 
       <Setter.Value> 
        <ControlTemplate TargetType="{x:Type Custom:CalendarItem}"> 
         <ControlTemplate.Resources> 
          <DataTemplate x:Key="DayTitleTemplate"> 
           <TextBlock HorizontalAlignment="Center" Margin="0,6" VerticalAlignment="Center" FontFamily="Verdana" FontSize="9.5" FontWeight="Bold" Foreground="#FF333333" Text="{Binding}"/> 
          </DataTemplate> 
         </ControlTemplate.Resources> 
         <Grid x:Name="PART_Root"> 
          <Grid.Resources> 
           <SolidColorBrush x:Key="DisabledColor" Color="#A5FFFFFF"/> 
          </Grid.Resources> 
          <VisualStateManager.VisualStateGroups> 
           <VisualStateGroup x:Name="CommonStates"> 
            <VisualState x:Name="Normal"/> 
            <VisualState x:Name="Disabled"> 
             <Storyboard> 
              <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="PART_DisabledVisual" Storyboard.TargetProperty="Opacity" To="1"/> 
             </Storyboard> 
            </VisualState> 
           </VisualStateGroup> 
          </VisualStateManager.VisualStateGroups> 
          <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1"> 
           <Border BorderBrush="White" BorderThickness="2" CornerRadius="1"> 
            <Grid> 
             <Grid.Resources> 
              <ControlTemplate x:Key="HeaderButtonTemplate" TargetType="{x:Type Button}"> 
               <Grid Cursor="Hand"> 
                <VisualStateManager.VisualStateGroups> 
                 <VisualStateGroup x:Name="CommonStates"> 
                  <VisualState x:Name="Normal"/> 
                  <VisualState x:Name="MouseOver"> 
                   <Storyboard> 
                    <ColorAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Color" To="#FF73A9D8"/> <!-- EXCEPTION --> 
                   </Storyboard> 
                  </VisualState> 
                  <VisualState x:Name="Disabled"> 
                   <Storyboard> 
                    <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="Opacity" To="0.5"/> 
                   </Storyboard> 
                  </VisualState> 
                 </VisualStateGroup> 
                </VisualStateManager.VisualStateGroups> 
                <ContentPresenter x:Name="buttonContent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,4,1,9" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" TextElement.Foreground="#FF333333" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/> 
               </Grid> 
              </ControlTemplate> 
              <ControlTemplate x:Key="NextButtonTemplate" TargetType="{x:Type Button}"> 
               <Grid Cursor="Hand"> 
                <VisualStateManager.VisualStateGroups> 
                 <VisualStateGroup x:Name="CommonStates"> 
                  <VisualState x:Name="Normal"/> 
                  <VisualState x:Name="MouseOver"> 
                   <Storyboard> 
                    <ColorAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Color" To="#FF73A9D8"/> 
                   </Storyboard> 
                  </VisualState> 
                  <VisualState x:Name="Disabled"> 
                   <Storyboard> 
                    <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Opacity" To="0.5"/> 
                   </Storyboard> 
                  </VisualState> 
                 </VisualStateGroup> 
                </VisualStateManager.VisualStateGroups> 
                <Rectangle Fill="#11E5EBF1" Stretch="Fill" Opacity="1"/> 
                <Grid> 
                 <Path Fill="#FF333333" Stretch="Fill" HorizontalAlignment="Right" Margin="0,-6,14,0" VerticalAlignment="Center" Width="6" Height="10" Data="M282.875,231.875L282.875,240.375 288.625,236z"/> 
                </Grid> 
               </Grid> 
              </ControlTemplate> 
              <ControlTemplate x:Key="PreviousButtonTemplate" TargetType="{x:Type Button}"> 
               <Grid Cursor="Hand"> 
                <VisualStateManager.VisualStateGroups> 
                 <VisualStateGroup x:Name="CommonStates"> 
                  <VisualState x:Name="Normal"/> 
                  <VisualState x:Name="MouseOver"> 
                   <Storyboard> 
                    <ColorAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Color" To="#FF73A9D8"/> 
                   </Storyboard> 
                  </VisualState> 
                  <VisualState x:Name="Disabled"> 
                   <Storyboard> 
                    <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Opacity" To="0.5"/> 
                   </Storyboard> 
                  </VisualState> 
                 </VisualStateGroup> 
                </VisualStateManager.VisualStateGroups> 
                <Rectangle Fill="#11E5EBF1" Stretch="Fill" Opacity="1"/> 
                <Grid> 
                 <Path Fill="#FF333333" Stretch="Fill" HorizontalAlignment="Left" Margin="14,-6,0,0" VerticalAlignment="Center" Width="6" Height="10" Data="M288.75,232.25L288.75,240.625 283,236.625z"/> 
                </Grid> 
               </Grid> 
              </ControlTemplate> 
             </Grid.Resources> 
             <Grid.ColumnDefinitions> 
              <ColumnDefinition Width="Auto"/> 
              <ColumnDefinition Width="Auto"/> 
              <ColumnDefinition Width="Auto"/> 
             </Grid.ColumnDefinitions> 
             <Grid.RowDefinitions> 
              <RowDefinition Height="Auto"/> 
              <RowDefinition Height="*"/> 
             </Grid.RowDefinitions> 
             <Button x:Name="PART_PreviousButton" HorizontalAlignment="Left" Width="28" Height="20" Focusable="False" Grid.Column="0" Grid.Row="0"> 
              <Button.Template> 
               <ControlTemplate TargetType="{x:Type Button}"> 
                <Grid Cursor="Hand"> 
                 <VisualStateManager.VisualStateGroups> 
                  <VisualStateGroup x:Name="CommonStates"> 
                   <VisualState x:Name="Normal"/> 
                   <VisualState x:Name="MouseOver"> 
                    <Storyboard> 
                     <ColorAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Color" To="#FF73A9D8"/> 
                    </Storyboard> 
                   </VisualState> 
                   <VisualState x:Name="Disabled"> 
                    <Storyboard> 
                     <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Opacity" To="0.5"/> 
                    </Storyboard> 
                   </VisualState> 
                  </VisualStateGroup> 
                 </VisualStateManager.VisualStateGroups> 
                 <Rectangle Fill="#11E5EBF1" Stretch="Fill" Opacity="1"/> 
                 <Grid> 
                  <Path Fill="#FF333333" Stretch="Fill" HorizontalAlignment="Left" Margin="14,-6,0,0" VerticalAlignment="Center" Width="6" Height="10" Data="M288.75,232.25L288.75,240.625 283,236.625z"/> 
                 </Grid> 
                </Grid> 
               </ControlTemplate> 
              </Button.Template> 
             </Button> 
             <Button x:Name="PART_HeaderButton" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="10.5" FontWeight="Bold" Focusable="False" Grid.Column="1" Grid.Row="0" Template="{DynamicResource ButtonControlTemplate1}"/> 
             <Button x:Name="PART_NextButton" HorizontalAlignment="Right" Width="28" Height="20" Focusable="False" Grid.Column="2" Grid.Row="0"> 
              <Button.Template> 
               <ControlTemplate TargetType="{x:Type Button}"> 
                <Grid Cursor="Hand"> 
                 <VisualStateManager.VisualStateGroups> 
                  <VisualStateGroup x:Name="CommonStates"> 
                   <VisualState x:Name="Normal"/> 
                   <VisualState x:Name="MouseOver"> 
                    <Storyboard> 
                     <ColorAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Color" To="#FF73A9D8"/> 
                    </Storyboard> 
                   </VisualState> 
                   <VisualState x:Name="Disabled"> 
                    <Storyboard> 
                     <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Opacity" To="0.5"/> 
                    </Storyboard> 
                   </VisualState> 
                  </VisualStateGroup> 
                 </VisualStateManager.VisualStateGroups> 
                 <Rectangle Fill="#11E5EBF1" Stretch="Fill" Opacity="1"/> 
                 <Grid> 
                  <Path Fill="#FF333333" Stretch="Fill" HorizontalAlignment="Right" Margin="0,-6,14,0" VerticalAlignment="Center" Width="6" Height="10" Data="M282.875,231.875L282.875,240.375 288.625,236z"/> 
                 </Grid> 
                </Grid> 
               </ControlTemplate> 
              </Button.Template> 
             </Button> 
             <Grid x:Name="PART_MonthView" Margin="6,-1,6,6" Visibility="Visible" Grid.ColumnSpan="3" Grid.Row="1"> 
              <Grid.ColumnDefinitions> 
               <ColumnDefinition Width="Auto"/> 
               <ColumnDefinition Width="Auto"/> 
               <ColumnDefinition Width="Auto"/> 
               <ColumnDefinition Width="Auto"/> 
               <ColumnDefinition Width="Auto"/> 
               <ColumnDefinition Width="Auto"/> 
               <ColumnDefinition Width="Auto"/> 
              </Grid.ColumnDefinitions> 
              <Grid.RowDefinitions> 
               <RowDefinition Height="Auto"/> 
               <RowDefinition Height="Auto"/> 
               <RowDefinition Height="Auto"/> 
               <RowDefinition Height="Auto"/> 
               <RowDefinition Height="Auto"/> 
               <RowDefinition Height="Auto"/> 
               <RowDefinition Height="Auto"/> 
              </Grid.RowDefinitions> 
             </Grid> 
             <Grid x:Name="PART_YearView" Margin="6,-3,7,6" Visibility="Hidden" Grid.ColumnSpan="3" Grid.Row="1"> 
              <Grid.ColumnDefinitions> 
               <ColumnDefinition Width="Auto"/> 
               <ColumnDefinition Width="Auto"/> 
               <ColumnDefinition Width="Auto"/> 
               <ColumnDefinition Width="Auto"/> 
              </Grid.ColumnDefinitions> 
              <Grid.RowDefinitions> 
               <RowDefinition Height="Auto"/> 
               <RowDefinition Height="Auto"/> 
               <RowDefinition Height="Auto"/> 
              </Grid.RowDefinitions> 
             </Grid> 
            </Grid> 
           </Border> 
          </Border> 
          <Rectangle x:Name="PART_DisabledVisual" Fill="#A5FFFFFF" Stretch="Fill" Stroke="#A5FFFFFF" StrokeThickness="1" RadiusX="2" RadiusY="2" Opacity="0" Visibility="Collapsed"/> 
         </Grid> 
         <ControlTemplate.Triggers> 
          <Trigger Property="IsEnabled" Value="False"> 
           <Setter Property="Visibility" TargetName="PART_DisabledVisual" Value="Visible"/> 
          </Trigger> 
          <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Custom:Calendar}}}" Value="Year"> 
           <Setter Property="Visibility" TargetName="PART_MonthView" Value="Hidden"/> 
           <Setter Property="Visibility" TargetName="PART_YearView" Value="Visible"/> 
          </DataTrigger> 
          <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Custom:Calendar}}}" Value="Decade"> 
           <Setter Property="Visibility" TargetName="PART_MonthView" Value="Hidden"/> 
           <Setter Property="Visibility" TargetName="PART_YearView" Value="Visible"/> 
          </DataTrigger> 
         </ControlTemplate.Triggers> 
        </ControlTemplate> 
       </Setter.Value> 
      </Setter> 
     </Style> 
     <ControlTemplate x:Key="ButtonControlTemplate1" TargetType="{x:Type Button}"> 
      <Grid Cursor="Hand"> 
       <VisualStateManager.VisualStateGroups> 
        <VisualStateGroup x:Name="CommonStates"> 
         <VisualState x:Name="Normal"/> 
         <VisualState x:Name="MouseOver"> 
          <Storyboard> 
           <ColorAnimation Duration="00:00:00" Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Color" To="#FF73A9D8"/> 
          </Storyboard> 
         </VisualState> 
         <VisualState x:Name="Disabled"> 
          <Storyboard> 
           <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="Opacity" To="0.5"/> 
          </Storyboard> 
         </VisualState> 
        </VisualStateGroup> 
       </VisualStateManager.VisualStateGroups> 
       <ContentPresenter x:Name="buttonContent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,4,1,9" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" TextElement.Foreground="#FF333333" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/> 
      </Grid> 
     </ControlTemplate> 
    </Window.Resources> 

    <Grid x:Name="LayoutRoot"> 
     <Custom:Calendar HorizontalAlignment="Left" VerticalAlignment="Top" Style="{DynamicResource CalendarStyle1}"/> 
    </Grid> 
</Window> 
+1

バグの場合は、おそらくチームが見なければならないものです。 Silverlight.netのフォーラムでの投稿を検討しましたか? –

+0

その最初のことをしました。今度は、コントロールテンプレートを修正する方法を理解する必要があるので、いくつかの簡単な変更を加えることができます。 –

答えて

5

私達はちょうど仕事で同じことを経験しました。これはWPFToolkitのバグではないようですが、元のテンプレートを作成した人がややこしくなっているため、Expression Blendに問題があります。

まず、デフォルトテンプレートを取得します。ソースをダウンロードすると、Toolkit-Release/Calendar/Themes/Generic.xamlに表示されます。ソースは、WPF Toolkit CodePlexサイトにあります。 http://wpf.codeplex.com/

CalendarItemTemplateは、セットアップのこの種を持っています

<Style TargetType="primitives:CalendarItem"> 
... 
<Setter Property="Template"> 
    <Setter.Value> 
     <ControlTemplate TargetType="primitives:CalendarItem"> 
      ... 
      <Grid Name="PART_Root" > 
       <Border 
        ... 
        <Border CornerRadius="1" BorderBrush="#FFFFFFFF" BorderThickness="2"> 
         <Grid> 
          <Grid.Resources> 
           <ControlTemplate x:Key="HeaderButtonTemplate" TargetType="Button"> 
          ... 
          <Button x:Name="PART_HeaderButton" Template="{StaticResource HeaderButtonTemplate}"  
          ... 

これは、元のHeaderButtonTemplateです:私たちに関係

<ControlTemplate x:Key="HeaderButtonTemplate" TargetType="Button"> 
    <Grid Cursor="Hand"> 
     <vsm:VisualStateManager.VisualStateGroups> 
      <vsm:VisualStateGroup x:Name="CommonStates"> 
       <vsm:VisualState x:Name="Normal" /> 
       <vsm:VisualState x:Name="MouseOver"> 
        <Storyboard> 
         <ColorAnimation Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Color" To="#FF73A9D8" Duration="0" /> 
        </Storyboard> 
       </vsm:VisualState> 
       <vsm:VisualState x:Name="Disabled"> 
        <Storyboard> 
         <DoubleAnimation Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="Opacity" To=".5" Duration="0" /> 
        </Storyboard> 
       </vsm:VisualState> 
      </vsm:VisualStateGroup> 
     </vsm:VisualStateManager.VisualStateGroups> 
     <ContentPresenter 
      x:Name="buttonContent" 
      Content="{TemplateBinding Content}" 
      ContentTemplate="{TemplateBinding ContentTemplate}" 
      Margin="1,4,1,9" 
      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> 
      <TextElement.Foreground> 
       <SolidColorBrush x:Name="TextColor" Color="#FF333333"/> 
      </TextElement.Foreground> 
     </ContentPresenter> 
    </Grid> 
</ControlTemplate> 

一部はここにある:

<ContentPresenter 
    x:Name="buttonContent" 
    Content="{TemplateBinding Content}" 
    ContentTemplate="{TemplateBinding ContentTemplate}" 
    Margin="1,4,1,9" 
    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> 
    <TextElement.Foreground> 
     <SolidColorBrush x:Name="TextColor" Color="#FF333333"/> 
    </TextElement.Foreground> 
</ContentPresenter> 

TextElementがプロパティに関連付けられていることに注目してくださいSolidColorBrushをインスタンス化します。これはストーリーボードの対象となる名前付きブラシです。

Blendで "Edit Copy of Template"を実行すると、ヘッダーボタンテンプレートがグリッドリソースに含まれる代わりに直接設定されるように、一部のテンプレートがインライン展開されます。

<Button x:Name="PART_HeaderButton" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="10.5" FontWeight="Bold" Focusable="False" Grid.Column="1" Grid.Row="0"> 
<Button.Template> 
    <ControlTemplate TargetType="{x:Type Button}"> 
    <Grid Cursor="Hand"> 

私はテンプレートのコピーを編集するとき、テンプレートの実際のコピーを期待しています。テンプレートは外部から参照されることもあるが、この場合はそうではないことを理解していると思います。たとえそれが完全であればコピーして、スタイル/コントロールテンプレートリソースに追加する方が賢明です。再処理ブレンドの一部は、このにそれを回す、テンプレート内のContentPresenterの定義を変更して、さらに悪いことに:

<ContentPresenter x:Name="buttonContent" 
    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
    Margin="1,4,1,9" 
    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
    ContentTemplate="{TemplateBinding ContentTemplate}" 
    Content="{TemplateBinding Content}" 
    TextElement.Foreground="#FF333333" /> 

だから、他の言葉でこれ以上のブラシと命名し、ストーリーボードのターゲットは今正しくありません。

幸いにも修正は簡単です。元のテンプレートを出発点として使用してください。問題は、何らかの理由で何らかの理由でContentPresenter上のこのプロパティを、拡張モードやそれが呼び出されたものではなく、開始タグの一部としてのみ設定できるため、ブレンドはそれを気に入らず、表示しません。もちろん、よりブレンド可能な別の方法で機能を複製することはおそらくかなり可能です。

EDIT:テンプレートをハックしてブレンド可能にする簡単な方法です。それは本当にハックですが、ほとんど無害です。私はこのようなことを普通に行うことを主張していませんが、うまくいくようです。小さすぎるが表示される場合は、技術的に目に見えるし、その後のContentPresenterにバインディングを実行します - -

<ControlTemplate x:Key="HeaderButtonTemplate" TargetType="Button"> 
    <Grid Cursor="Hand"> 
     <vsm:VisualStateManager.VisualStateGroups> 
      <vsm:VisualStateGroup x:Name="CommonStates"> 
       <vsm:VisualState x:Name="Normal" /> 
       <vsm:VisualState x:Name="MouseOver"> 
        <Storyboard> 
         <ColorAnimation Storyboard.TargetName="TextColor" Storyboard.TargetProperty="Color" To="#FF73A9D8" Duration="0" /> 
        </Storyboard> 
       </vsm:VisualState> 
       <vsm:VisualState x:Name="Disabled"> 
        <Storyboard> 
         <DoubleAnimation Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="Opacity" To=".5" Duration="0" /> 
        </Storyboard> 
       </vsm:VisualState> 
      </vsm:VisualStateGroup> 
     </vsm:VisualStateManager.VisualStateGroups> 
     <!-- A dummy Rectangle that is essentially a container for the TextColor brush --> 
     <Rectangle Width="0" Height="0"> 
      <Rectangle.Fill> 
       <SolidColorBrush x:Name="TextColor" Color="#FF333333"/> 
      </Rectangle.Fill> 
     </Rectangle> 
     <ContentPresenter 
       x:Name="buttonContent" 
       Content="{TemplateBinding Content}" 
       ContentTemplate="{TemplateBinding ContentTemplate}" 
       Margin="1,4,1,9" 
       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
       VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
       TextElement.Foreground="{Binding ElementName=TextColor}"> 
     </ContentPresenter> 
    </Grid> 
</ControlTemplate> 

そのエッセンスは、他のオブジェクトの一部としてブラシを収容することで、それが開いタグBlendで行われているため」doesnのtは不平を言う。うん、私は知っている、この種の匂いが、それが動作するように私が見ることができる元のテンプレートの最小の書き換えです。

+0

受け入れられた*および* upvote。特に厄介な質問への答えをありがとう! –

+0

Expression Blendフィードバックページのバグとして送信されました:https://connect.microsoft.com/Expression/feedback/ViewFeedback.aspx?Feedback=495224 –

+0

あなたは歓迎です - 私は自分の答えを編集して、すばやく汚い方法を提供しましたそれをブレンド可能にする。 – Egor

関連する問題