在下面的F#WPF代码中,当我从F#FSI显示"WPF"窗口时,我无法在文本框中输入任何文本.这与使用Windows窗体事件循环有关吗?
let txtBox = new TextBox()
txtBox.BorderThickness <- Thickness(2.)
txtBox.Margin <- Thickness(7.)
txtBox.IsReadOnly <- false
let wnd = new Window(Title = "Test", Height = 500., Width = 500.)
wnd.Content <- txtBox
wnd.Show()
Run Code Online (Sandbox Code Playgroud)
基于John Palmer的以下答案,我已使用正确的版本更新了上面的代码.下面的代码现在在F#FSI中正常工作.
let txtBox = new TextBox()
txtBox.BorderThickness <- Thickness(2.)
txtBox.Margin <- Thickness(7.)
txtBox.IsReadOnly <- false
let wnd = new Window(Title = "Test", Height = 500., Width = 500.)
wnd.Content <- txtBox
(new Application()).Run(wnd) |> ignore
Run Code Online (Sandbox Code Playgroud)