MVVM And Mogre


12-01-2015 17:01:35

I've been using Mogre for quite some time now in WPF and I was wondering if it was possible to databind Mogre so that is uses the mvvm pattern, i.e being databound to something inside of a viewmodel. I've tried multiple things but I've been unsuccessful. Right now the only way I can implement it is by having code in the view which is tied to the codebehind of the page, but I'd rather not have it this way. Any help would be appreciated.




12-01-2015 21:22:36

Hi Animooted,

it's great to hear that you successfully use WPF in connection with Mogre.
There were only a few people in the past who tried this (and had trouble).
Do you use WPF as GUI overlay? Can you show us a screenshot?
I'm very interested.

Unfortunately I don't know what's MVVM. So I can't help you.


12-01-2015 21:43:31

I'm using WPF to host a Mogre object like this currently:

<Image Grid.Column="0" x:Name="RenderTargetControl" Stretch="Fill"

<OgreLib:OgreImage x:Name="_ogreImage"
Initialised="_image_InitScene" PreRender="_image_PreRender"

I'm using a project I found I believe in the examples for Mogre. You can see it has listeners like "initialised and preRender" which are in the codebehind in wpf. I wan't to change it to something like this for example:

<TextBox Name="FirstNameTextBox"
Text="{Binding fname}"/>

The problem is, I cannot simple just add "{Binding MethoName}" to initialised or preRender, because its a custom extension of an Image. I'm really not sure how or if its even possible to databind something like this.