Skip to content

Is there a way to dispose ViewModels created by BindKeyedList? #57

Closed Answered by JordanMarr
marklam asked this question in Q&A
Discussion options

You must be logged in to vote

I think you should be able to add them to the disposables list on your VM:

member this.AddDisposable(disposable: IDisposable) =

For example:

type ActionVM(action: Action) =
    inherit ReactiveElmishViewModel()
    
    member this.Timestamp = action.Timestamp
    member this.Description = action.Description

    interface IDisposable with
        member this.Dispose() = printfn "Disposing ActionVM"

type CounterViewModel() as this =
    inherit ReactiveElmishViewModel()

    let local = 
        Program.mkAvaloniaSimple init update
        |> Program.mkStore

    let mkActionVM act…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by marklam
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants