none
FluidMoveBehavior的使用 RRS feed

  • 问题

  • WPF应用程序,FluidMoveBehavior使用于ListView

    我是在Blend4中进行编辑的

    我展开模板编辑后为ItemPresenter添加了FluidMoveBehavior行为,但运行后却没有效果

     

        			<ControlTemplate TargetType="{x:Type ListView}">
        				<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" 
                    BorderThickness="{TemplateBinding BorderThickness}" 
                    Background="{TemplateBinding Background}" Padding="1" 
                    SnapsToDevicePixels="true">
        					<ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
        						<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
        							<i:Interaction.Behaviors>
                        <ei:FluidMoveBehavior />
                      </i:Interaction.Behaviors>
        						</ItemsPresenter>
        					</ScrollViewer>
        				</Border>
        				<ControlTemplate.Triggers>
        					<Trigger Property="IsEnabled" Value="false">
        						<Setter Property="Background" TargetName="Bd" 
                        Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
        					</Trigger>
        					<Trigger Property="IsGrouping" Value="true">
        						<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
        					</Trigger>
        				</ControlTemplate.Triggers>
        			</ControlTemplate>

    2011年4月28日 9:05

答案

  • 你好,

    你可以参考下 烤地瓜 大侠的这片博客: http://www.cnblogs.com/kaodigua/archive/2011/03/02/1968726.html

    我们应该把 FluidMoveBehavior  设置到ListView的ItemsPanel上,

    我在WPF 中测试了以下的例子,可行的:

     <ListView x:Name="listView" ItemsSource="{Binding}">
      <ListView.ItemTemplate>
       <DataTemplate>
        <TextBlock Text="{Binding Name}"/>
       </DataTemplate>
      </ListView.ItemTemplate>
      <ListView.ItemsPanel>
       <ItemsPanelTemplate>
        <UniformGrid>
         <i:Interaction.Behaviors>
          <ei:FluidMoveBehavior AppliesTo="Children" Duration="0:0:5">
           <ei:FluidMoveBehavior.EaseY>
            <BackEase EasingMode="EaseInOut"/>
           </ei:FluidMoveBehavior.EaseY>
           <ei:FluidMoveBehavior.EaseX>
            <BackEase EasingMode="EaseOut"/>
           </ei:FluidMoveBehavior.EaseX>
          </ei:FluidMoveBehavior>
         </i:Interaction.Behaviors>
        </UniformGrid>
       </ItemsPanelTemplate>
      </ListView.ItemsPanel>
     </ListView>
    

     

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年5月2日 3:55
    版主