zoukankan      html  css  js  c++  java
  • DataBinding之 MultiBinding

    MilkTea.Common

    转换器:

    namespace MilkTea.Common
    {
      public class MultiBindingConverter:IMultiValueConverter
      {
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
          //return values;
          return values.ToArray();
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
          throw new NotImplementedException();
        }
      }
    }

    xaml:

      xmlns:comm="clr-namespace:MilkTea.Common;assembly=MilkTea.Common"

    <Window.Resources>

      <comm:MultiBindingConverter x:Key="MyConverter"></comm:MultiBindingConverter>

    </Window.Resources>

    <Button Content="确定" Height="32" HorizontalAlignment="Left" Margin="113,243.333,0,0" x:Name="button1" VerticalAlignment="Top" Width="98" IsDefault="True"    Command="{Binding SubmitSetTasteCommand}">
      <Button.CommandParameter>
        <MultiBinding Converter="{StaticResource MyConverter}">
          <Binding ElementName="datagrid"></Binding>
          <Binding ElementName="myTesteWnd"></Binding>
        </MultiBinding>
      </Button.CommandParameter>
    </Button>

    MainViewModel.cs:

    public ICommand SubmitSetTasteCommand
    {
    get
      {
        return new DelegateCommand<object>(
        (obj) =>
        {
        var args = (object[])obj;
        var gridview = (Telerik.Windows.Controls.RadGridView)args[0];
        var win = (Window)args[1];
        var selects = gridview.SelectedItems;

        });

      }

    }

  • 相关阅读:
    Linux Shell脚本编程实用技巧
    Transmission在Pandorabox(Openwrt)下的交叉编译
    Pandorabox下关于vsftpd匿名访问的设置
    PandoraBox下部署阿里云(aliyun)DDNS动态域名更新(shell脚本)
    win7系统封装小记
    CF R#295 (DIV.2) E. Pluses everywhere
    CF R#295 (DIV.2) D. Cubes
    CF R#295 (DIV.2) C. DNA Alignment
    winform在线操作office--dsoframerocx第三方控件
    Dapper操作
  • 原文地址:https://www.cnblogs.com/gnsds/p/3725893.html
Copyright © 2011-2022 走看看