简体   繁体   English

c#wpf重新单击组合框项

[英]c# wpf reclick combobox item

i have the following problem. 我有以下问题。 I made a combobox in c# wpf. 我在c#wpf中制作了一个组合框。 When i select an item, some data is loaded in a textbox. 当我选择一个项目时,一些数据会加载到文本框中。 I have 3 buttons, change,delete and add. 我有3个按钮,进行更改,删除和添加。

The problem is, when i for example change something in the textbox(didn't save it yet) but i want to go back to the original value in the textbox. 问题是,例如,当我在文本框中更改某些内容(尚未保存)但我想返回到文本框中的原始值时。 You can use ctr-z to go back. 您可以使用ctr-z返回。 Is it also possible to reclick the selected item in the combobox to reload the data again? 是否还可以在组合框中重新单击选定的项目以再次重新加载数据? Now this is not possible, because the data is only loaded when the selectedItem in the combobox has changed, but that is not the case now. 现在这是不可能的,因为仅在组合框中的selectedItem更改时才加载数据,但现在不是这种情况。 How can i add a reclick option in the combobox? 如何在组合框中添加重新单击选项?

thanks a lot 非常感谢

If you post some code to let people have the big picture. 如果您发布一些代码来使人们有一个广阔的前景。

As a short answer: you may use SelectedItem property in the combobox to selected the item programmatically, basing on the value in your text box. 简短的答案是:您可以根据文本框中的值,使用组合框中的SelectedItem属性以编程方式选择该项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM