从XAML弹出窗口返回特定的属性值C#

时间:2019-02-07 01:22:55

标签: c# xaml autocad modal-window

基本上,我会在代码期间生成一个新的XAML窗口,并基于该窗口中所做的更改或选择,我希望将值返回到原始窗口。  我有以下代码

listOptions //list of items/numbers to pick from
bool? oked = false;
System.Windows.Window win = new Options(listOptions);
oked = Autodesk.AutoCAD.ApplicationServices.Application.ShowModalWindow(win); /*makes a window popup, that being Options.xaml
options has a built in DataGrid that will display listOptions 
there the user can pick whichever option they want and that is the value
OptionPicked which I'd like to return to this code to do something with it*/

这可以生成一个新窗口,但是我不知道如何从基于列表的DataGrid返回所选值。 在新的“选项”窗口中,后面是一个C#,属性为OptionSelected,这就是我想返回到原始窗口的内容。

我的想法基本上是做类似的事情:

Option which = win.OptionPicked;

或类似的东西,但似乎不起作用。

0 个答案:

没有答案