将参数传递给验证例程

编程入门 行业动态 更新时间:2024-10-26 20:22:53
本文介绍了将参数传递给验证例程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个带有ComboBox和TextBox的wpf窗口(以及许多与此无关的其他内容),并且我正在尝试为Textbox编写验证例程. 在我的XAML中,我有:

I have a wpf window with a ComboBox and a TextBox (and lots of other stuff not relevant here) and I am trying to write a validation routine for the Textbox. In my XAML I have:

<TextBox> <Binding Path="Charge" UpdateSourceTrigger="Explicit"> <Binding.ValidationRules> <abc:VT /> </Binding.ValidationRules> </Binding> </TextBox>

其中VT是我的验证例程,而"abc"是我的验证例程是一个程序集,其中包含项目中使用的所有验证例程,并且在我的项目参考中. 我遇到的问题是,VT需要知道ComboBox的SelectedValue才能知道如何执行验证.如何将这些数据导入VT?

where VT is my validation routine and "abc" is an assembly that contains all the validation routines used in the project and is in my Project References. The problem I'm having is that VT needs to know the SelectedValue of the ComboBox in order to know how to perform the validation. How do I get that data into VT?

推荐答案

我有一个带有ComboBox和TextBox的wpf窗口(以及许多此处不相关的其他内容),并且我正在尝试为Textbox编写验证例程.

I have a wpf window with a ComboBox and a TextBox (and lots of other stuff not relevant here) and I am trying to write a validation routine for the Textbox.

有关WPF的问题应在中提出 Windows Presentation基金会(WPF) 论坛.

Questions relating to WPF should be asked at the Windows Presentation Foundation (WPF)forum.

更多推荐

将参数传递给验证例程

本文发布于:2023-11-17 05:57:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609073.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:例程   参数

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!