17,740
社区成员
发帖
与我相关
我的任务
分享
<Window.Resources>
<local:DataConverter x:Key="dataConverter"/>
</Window.Resources>
<Button Header="添加用户" Icon="Images\Green.png" LargeIcon="Images\GreenLarge.png" x:Name="BtnAddUser" Command="{Binding AddUserCommand}">
<Button.CommandParameter>
<MultiBinding Converter="{ StaticResource ResourceKey=dataConverter}" Mode="TwoWay">
<MultiBinding.Bindings>
<Binding ElementName="BtnAddUser"/>
<Binding ElementName="dockManager "/>
</MultiBinding.Bindings>
</MultiBinding>
</Button.CommandParameter>
</Button>
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace TLAgent.SecurityManager.WPF.MultiBindings
{
public class DataConverter : IMultiValueConverter
{
#region IMultiValueConverter Members
public static object ConverterObject;
public object Convert(object[] values, Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
ConverterObject = values;
return values;
}
public object[] ConvertBack(object value, Type[] targetTypes,
object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
}