Here is what I have done using FsXaml
type MainViewModel() as self =
inherit ViewModelBase()
let listOfData = self.Factory.Backing(<@self.ListOfData@>, 0 :> obj)
let selectedId = self.Factory.Backing(<@self.SelectedId@>, 0)
member x.SelectedId with get() = selectedId.Value
and set value = selectedId.Value <- value;
x.ListOfData <- returnPrice(value) :> obj
member x.StockList with get() = stockList
member x.ListOfData with get() = listOfData.Value and set value = listOfData.Value <- value
and in xaml
<ComboBox Grid.Row="1" ItemsSource="{Binding StockList}"
DisplayMemberPath="Code"
SelectedValuePath="Id" SelectedValue="{Binding SelectedId}"/>
<DataGrid Grid.Row="2" ItemsSource="{Binding ListOfData}"/>
How can I use command dependecy of ViewModule
to set x.ListOfData
instead of calling returnPrice(value)
in setter of x.SelectedId
?