WPF CommandParameter 传递多个参数的方法
1、新建一个按钮内容如下
<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>
2、新建一个类继承:IMultiValueConverter
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
}
3、最后在主窗口引入
<Window.Resources>
<local:ObjectConvert x:Key="objectConverter"/>
</Window.Resources>
WPF CommandParameter 传递多个参数的方法的更多相关文章
- spring mvc 后端获得前端传递过来的参数的方法
1.通过HttpServletRequest 获得 HttpServletRequest.getParameter(参数名),可以获得form表单中传递的参数,或ajax或url中传递过来的参数,如果 ...
- 【转载】spring mvc 后端获得前端传递过来的参数的方法
1.通过HttpServletRequest 获得 HttpServletRequest.getParameter(参数名),可以获得form表单中传递的参数,或ajax或url中传递过来的参数,如果 ...
- CreateThread传递多个参数的方法(利用结构体的参数指针)
很多朋友一直都在问CreateThread如何传递多个参数,CreateThread传递参数的方式是指针传递的,所以这里也可以利用指针来做!Demo 关键代码如下: type TfrmTestThr ...
- EasyUi 方法传递多个参数值得方法
1.项目中需要传递多个参数值 function actionFtt(value, row, index) { //传递查询需要的参数 var customerId = row.customerId;/ ...
- Mybatis中传递多个参数的方法总结
一.单个参数: public List<XXBean> getXXBeanList(String xxCode); <select id="getXXXBeanList&q ...
- Mybatis 传递多个参数
Mybatis提供了4种传递多个参数的方法: 1 Map sql语句 接口 调用方法 这个方法虽然简单易用,但是存在一个弊端:Map存储的元素是键值对,可读性不好. 2 注解 使用MyBatis的参数 ...
- Dao层向sql语句传递多个参数
手动封装: serviceImpl层 Map<String, Object> params = new HashMap<String, Object>(2);params.pu ...
- wpf mvvm模式下CommandParameter传递多参
原文:wpf mvvm模式下CommandParameter传递多参 CommandParameter一般只允许设置一次,所以如果要传递多参数,就要稍微处理一下.我暂时还没找到更好的方案,下面介绍的这 ...
- 【问题】Asp.net MVC 的cshtml页面中调用JS方法传递字符串变量参数
[问题]Asp.net MVC 的cshtml页面中调用JS方法传递字符串变量参数. [解决]直接对变量加引号,如: <button onclick="deleteProduct('@ ...
- Django URL传递参数的方法总结(转)
1 无参数情况 配置URL及其视图如下: 1 2 3 4 (r'^hello/$', hello) def hello(request): return HttpResponse("He ...
随机推荐
- day08-功能实现07
家居网购项目实现07 以下皆为部分代码,详见 https://github.com/liyuelian/furniture_mall.git 16.功能15-会员显示登录名 16.1需求分析/图解 会 ...
- Java面试的一些面试题
10<<2=? tip:10的二进制为1010,左移两位即:101000,换算为十进制为2的5次方加上2的三次方等于40 答:40 1.dr-xr-xr-r解释一下权限的含义 tip: ...
- 新下载了一个框架,然后npm install时候报错npm ERR! Maximum call stack size exceeded
今天遇到这个npm ERR! Maximum call stack size exceeded报错 解决方案如下: 1.更新npm版本 //查看版本 npm -v //更新 npm install - ...
- Echarts自适应屏幕,无需刷新网页,可根据屏幕大小完美展现,内有详细代码注释,我可真是个小机灵~~O(∩_∩)O哈哈~
Echarts自适应屏幕,无需刷新网页,可根据屏幕大小完美展现 效果如图 随意拖拉,无惧检验 ~ ~ ~ ~ 下面上代码 里边有详细解释 <template> <div class= ...
- vue修改内容点击显示隐藏内容不自动刷新问题
今天遇到一个在card组件中点击显示隐藏的问题,修改了动态绑定的值,但是组件内容没有刷新,但是偶而其他元素修改导致页面动态刷新又刷新了,就猜想修改这个数组中一个对象的值并没有引起vue的动态刷新 解决 ...
- python处理apiDoc转swagger
python处理apiDoc转swagger 需要转换的接口 现在我需要转换的接口全是nodejs写的数据,而且均为post传输的json格式接口 apiDoc格式 apiDoc代码中的格式如下: / ...
- Longbow.Tasks
Longbow.Tasks 概述 大体分为了Scheduler(调度任务),Storage(持久化),Trigger(触发器),Task(任务)和逻辑模块,大体流程为通过逻辑代码进行实例化相关类,根据 ...
- Django-Ajax、form组件
1.Ajax 1.AJAX:不是新的编程语言,而是一种使用现有标准的新方法,我们目前学习的是jQuery版本.特点:异步提交,局部刷新. 2.AJAX 最大的优点是在不重新加载整个页面的情况下,可以与 ...
- .NET List集合对比差异,Get,Post请求
1.键值排序 Dictionary<int, List<string>> dic = new Dictionary<int, List<string>> ...
- Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation
1.出现问题 查询数据时报如题错误 2.解决方案 建表时需指定字符集,例如: -- ---------------------------- -- Table structure for testTa ...