Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Saving a rendered bitmap from a WPF visual in MVVM.

Back to Forum: Tech Off
  • User profile image

    I've got an application that needs to write a sort of "screenshot" of a control to disk as a bitmap. I can use RenderTargetBitmap.Render() to render the visual and everything, but how do I do this from the viewmodel?

    The viewmodel receives a message (via the MVVMLight Messenger classes) that a bitmap needs to be saved, and in order to do that, it needs a reference to the visual. Which means a reference to the view, which ties my viewmodel to my specific view, which I don't want.

    Another idea would be to have the view render the bitmap and expose it to the view in some way via a OneWayToSource binding, but I have no idea how to tell it when to update via the viewmodel.

    Anyone got any ideas?

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.