如何将GotFocus的价值复制到新的Combobox中? .NET WPF
问题描述:
在XAML文件中我的ComboBox这样的:如何将GotFocus的价值复制到新的Combobox中? .NET WPF
<ComboBox Name="please" GotFocus="JutstDoIt">
<!-- some ComboBoxItems -->
</ComboBox>
在C#中的文件我想的GotFocus值从 “请” 复制到新的ComboBox
//ninja code
ComboBox powerranger= new ComboBox();
powerranger.Name = "iwillbeaninja";
//other not important ninja code
powerranger.GotFocus = please.GotFocus; //It's not working!!!! :(
//more ninja code
我知道...这是事件,而不是财产。
答
好吧!我的senpai给了我一个答案!
powerranger.GotFocus += new RoutedEventHandler(NameOfFunction);
这很好!