码迷,mamicode.com
首页 > 其他好文 > 详细

DataBinding之 MultiBinding

时间:2014-05-16 08:43:47      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:style   class   c   tar   color   width   

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;

    });

  }

}

DataBinding之 MultiBinding,布布扣,bubuko.com

DataBinding之 MultiBinding

标签:style   class   c   tar   color   width   

原文地址:http://www.cnblogs.com/gnsds/p/3725893.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!