WPF按钮命令参数配置 [英] WPF Button Command Parameter config

查看:106
本文介绍了WPF按钮命令参数配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个工具,但是我也不想在后台敲我的主程序代码,所以我想属性绑定命令按钮,但是不知道如何编写代码,这是我的工具使用者介面:
http://desmond.imageshack.us/Himg840/scaled. php?server = 840& filename = psminitoolui.jpg& res = medium [
然后选择适当的文件,然后单击查询按钮"将获得相应的结果.

哪位专家可以教我,给我一些最好的代码.

最好的祝愿

I want a tool, but I do not want to knock my main program code in the background too, so I would like to attribute to bind the command button, but do not know how to write code, here is my tool of UI:
http://desmond.imageshack.us/Himg840/scaled.php?server=840&filename=psminitoolui.jpg&res=medium[^]

I want to implement the function: select the appropriate radioButton, Query button will query according to different conditions of data, of course, how to execute the query results here, how do I know, I mainly want to improve the readability of my code,

I now mainly use MVC implementation code, so the plot in MainWindow push a lot of code, mainly because some button''s clcik time, there radioButton and some checkBox the check / uncheck event, so

I am very poor code readability, and so want to achieve with the WPF Command, but I am a beginner, the MVVM for WPF is not really understand, for ICommand is not very clear, so I hope what expert advice and guidance to some,

I would like to once again explain the problem, for example for example: I choose BugIDs, then enter the appropriate subsequent textBox ID, and then click Query Button will get results and displayed; and if I choose PSQ File

Then select the appropriate file, and then click Query Button will get the corresponding results.

Which expert can teach me, give me some of the best code.

Best Wishes

推荐答案

请参阅我对问题的评论.当您说不知道如何编写代码"时,您可能已经高估了自己的知识.你什么都不知道.您不知道该按钮和任何其他UI元素都与背景"或前景"无关.您甚至都不了解按钮没有被编程为具有绑定到其单击的任何功能.

您的要求超出了您所能满足的范围,没有提及获得任何帮助后立即编写应用程序的能力.首先,您应该学习如何获得帮助.

您的主要问题是您未能从所需功能的构想中分离出所需功能的描述.问题不在于您的想法是对还是错.问题是,如果现实存在,您将看不到现实与理解之间的界限,试图将您的问题建立在您偏爱的某些想法的基础上,无论是对还是错(在这种情况下,看起来他们是错的). br/>
首先,您需要分享您的最终目标.不仅要解释您要实现的目标,还要解释原因.不要对建议应用任何约束,因为您不知道它们是正确还是错误.

接受您的我想要"与可能"或不可能"无关的想法.通常,这些语句没有分类为"true"和"false",甚至与之接近.请记住,陈述涉及现实生活中的语言.因此,它们大致分为真",假"和乱码",请参见
http://en.wikipedia.org/Wiki/乱码 [ ^ ].

请阅读 http://en.wikipedia.org/wiki/Gibberish [ ^ ].

另请参见以下讨论:如何提出一个好问题? [^ ](不仅仅是我的回答,而是整个讨论).

另请参阅我对相关问题的解释:编程中的类和封装之间有什么区别 [
Please see my comment to the question. When you say that you "don''t know how to write your code", you probably already over-estimate your knowledge. You don''t know something else. You don''t know that the button and any other UI elements have nothing to do with "background" or "foreground". You don''t even understand that buttons are not programmed to carry any functionality bound to their clicks.

You request is simply beyond the help that would satisfy you, not mentioning your ability to write the application immediately after getting any help. First, you should learn how to get help.

You main problem is that you failed to isolate description of required functionality form your idea on how it should be achieved. The problem is not that your ideas are wrong or right; the problem is that you cannot see the boundary between reality and your understanding if this reality, trying to base your question on some ideas you are preoccupied with, no matter right or wrong (and in this very case it looks they are wrong).

First of all, you would need to share your ultimate goals. Not just explain what you want to achieve, explain why. Don''t apply any constraints to the advice, as you don''t understand if they are valid or wrong.

Embrace the idea that your "I want" is not really about "possible" or "impossible". Generally, the statements are not classified into "true" and "false", not even close to that. Remember that statements involve real-life language. So, they are roughly classified into "true", "false" and "gibberish", see http://en.wikipedia.org/wiki/Gibberish[^].

Please, read the rules for asking questions at http://en.wikipedia.org/wiki/Gibberish[^].

See also this discussion: How to ask a good question?[^] (not just my answer but the whole discussion).

Please also see my explanation of the related issue: what is the difference between the class and encapsulation in programming[^].

Good luck,
—SA


这篇关于WPF按钮命令参数配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆