zoukankan      html  css  js  c++  java
  • StackPanel Binding

    注意<i:Interaction>需要使用Blend的System.Windows.Interactivity.dll文件。

    Xaml文件:

    <StackPanel Width="200" Height="auto" MaxHeight="400" Grid.Row="1">
      <ItemsControl ItemsSource="{Binding MenuSet}">
      <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
          <StackPanel HorizontalAlignment="Center" IsItemsHost="True"></StackPanel>
        </ItemsPanelTemplate>
      </ItemsControl.ItemsPanel>
      <ItemsControl.ItemTemplate>
        <DataTemplate>
          <TextBlock Text="{Binding Name}" Name="txtb">
            <i:Interaction.Triggers>
            <i:EventTrigger EventName="MouseLeftButtonDown">
        

              <i:InvokeCommandAction CommandParameter="{Binding ElementName=txtb}"
              Command="{Binding Path=DataContext.ModifyCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type            StackPanel}}}">

            </i:InvokeCommandAction>

            </i:EventTrigger>
            </i:Interaction.Triggers>
          </TextBlock>
        </DataTemplate>
      </ItemsControl.ItemTemplate>
     </ItemsControl>
    </StackPanel>

     

     

    ViewModel: 注意DelegateCommand需要Prism中的Microsoft.Practices.Prism.dll。

    Model:

  • 相关阅读:
    js最佳实践
    js图片库 案例
    DOM
    js语法
    导航栏的ul中的li设置问题
    wDatepicker97的用法(点击事件联动)
    jqueyr validtion的使用
    哥哥写的例子(后台没有进行排序分组的时候,前台进行自己分组)
    关于require js加载的时候报错的问题
    一些简单的三目运算的使用(举例购物车)
  • 原文地址:https://www.cnblogs.com/gnsds/p/3632259.html
Copyright © 2011-2022 走看看