Updating FOV from bound code

Dec 20, 2011 at 4:02 PM

I have the field of view of a perspective camera bound to a int variable in the code behind. Right now, it will not update the field of view until I "flick" the mouse with the right mouse button. Just rotating around will not cause the update. Is there something, perhaps a function that I can call, to force the camera FOV to update automatically?

Coordinator
Dec 21, 2011 at 8:36 PM

Sorry, I don't understand the problem here.

Here is an example binding the FieldOfView property of a PerspectiveCamera to a Slider

<Grid>
	<helix:HelixViewport3D>
        	<helix:DefaultLights/>
                <helix:CubeVisual3D SideLength="4" Fill="Blue"/>
                <helix:HelixViewport3D.Camera>
                	<PerspectiveCamera FieldOfView="{Binding Value, ElementName=FieldOfViewSlider}"/>
                </helix:HelixViewport3D.Camera>
        </helix:HelixViewport3D>
        <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="8">
                <Slider Name="FieldOfViewSlider" Value="45" Minimum="10" Maximum="160" Width="200"/>
        </StackPanel>
</Grid>
Binding to a property in the DataContext should work the same way. Are you raising INotifyPropertyChanged events?

Dec 21, 2011 at 8:45 PM

Let me see if I can clarify...I am an idiot and forgot to raise a propertychanged event. It works just fine now.