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:

  • 相关阅读:
    Flexcell 导出Excel 打不开,提示Excel在“XXXX.xls” 中发现不可读取的内容。是否要回复此工作薄的内容?如果信任此工作薄的来源,请点击“是”。
    文件上传
    ssrf
    信息收集
    xss
    SQL注入
    Apache Flink CVE-2020-17519漏洞复现
    activemq
    centos6使用yum快速搭建LAMP
    Fastjson<=1.2.47反序列化漏洞复现
  • 原文地址:https://www.cnblogs.com/gnsds/p/3632259.html
Copyright © 2011-2022 走看看