WPF CommandParameter 传递多个参数的方法

<Button Name="btnOK" 
                            Content="确定" 
                            Height="20"
                            Width="50"
                            Background="#00FF99"  
                            HorizontalAlignment="Left" 
                            Margin="442,30,0,0" 
                            VerticalAlignment="Top" 
                            Command="{Binding ConfirmCommand}"
                            >
                        <Button.CommandParameter>
                            <MultiBinding Converter="{ StaticResource ResourceKey=objectConverter}" Mode="TwoWay">
                                <MultiBinding.Bindings>
                                    <Binding ElementName="dataPickerInts" Path="Datas"/>
                                    <Binding ElementName="dataPickerBytes" Path="Datas"/>
                                </MultiBinding.Bindings>
                            </MultiBinding>
                        </Button.CommandParameter>
                    </Button>
<Window.Resources>
        <local:ObjectConvert x:Key="objectConverter"/>
    </Window.Resources>
/*----------------------------------------------------------------
 * 作    者 :姜  彦 
 * 项目名称 :AE240_Simulator.View
 * 类 名 称 :ObjectConvert 
 * 命名空间 :AE240_Simulator.View
 * CLR 版本 :4.0.30319.42000
 * 创建时间 :2018/6/28 20:57:47
 * 当前版本 :1.0.0.1 
 *  
 * 描述说明: 
 * 
 * 修改历史: 
 * 
*******************************************************************
 * Copyright @ JiangYan 2018. All rights reserved.
*******************************************************************
//----------------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace AE240_Simulator.View
{
    /// <summary>
    /// CommandParameter 多参数传递
    /// </summary>
    public class ObjectConvert : IMultiValueConverter
    {
        #region IMultiValueConverter Members

        public static object ConverterObject;       

        public object Convert(object[] values, Type targetType,
          object parameter, System.Globalization.CultureInfo culture)
        {
            ConverterObject = values;
            string str = values.GetType().ToString();   
            return values.ToArray();
        }

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

        #endregion
    }
}

 

posted @ 2018-06-30 23:00  <--青青子衿-->  阅读(3722)  评论(0编辑  收藏  举报
// /**/ // 在页脚Html代码 引入 // function btn_donateClick() { var DivPopup = document.getElementById('Div_popup'); var DivMasklayer = document.getElementById('div_masklayer'); DivMasklayer.style.display = 'block'; DivPopup.style.display = 'block'; var h = Div_popup.clientHeight; with (Div_popup.style) { marginTop = -h / 2 + 'px'; } } function MasklayerClick() { var masklayer = document.getElementById('div_masklayer'); var divImg = document.getElementById("Div_popup"); masklayer.style.display = "none"; divImg.style.display = "none"; } setTimeout( function () { document.getElementById('div_masklayer').onclick = MasklayerClick; document.getElementById('btn_donate').onclick = btn_donateClick; var a_gzw = document.getElementById("guanzhuwo"); a_gzw.href = "javascript:void(0);"; $("#guanzhuwo").attr("onclick","follow('33513f9f-ba13-e011-ac81-842b2b196315');"); }, 900);