1

我有一个绑定到 XAML 文件的类。
在第一次调用它时,字段 selectedudl 为 = null。

你知道为什么会这样吗?
我本来希望它是 = "" ..

type QuotesViewModel() =
    inherit ViewModelBase()
    let mutable histo = Array.empty
    let mutable selectedudl = ""

    member x.GetUnderlyings = seq { yield "one"; yield "two"}

    member x.SelectedUdl 
      with get() = selectedudl
      and set value = 
               selectedudl  <- value
               x.OnPropertyChanged <@ x.SelectedUdl @>
               x.OnPropertyChanged <@ x.SelectedGraph @>

    member x.SelectedGraph 
      with get() = 
               let graph  = asyncquotes.visualizehistoForUdl  selectedudl
               let host =  new System.Windows.Forms.Integration.WindowsFormsHost()
               host.Child <- new ChartControl(graph, Dock = DockStyle.Fill)
               host
4

0 回答 0