Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Translate transform in code

Translate transform in code

Scheduled Pinned Locked Moved WPF
wpfcsharpwcfquestionlearning
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AghaKhan
    wrote on last edited by
    #1

    I have a class which builds cubes.One of its properties is to translate to diffrent part of the screen. testCube is object of that class. testCube.Translate = new TranslateTransform3D(0, -1, 1); I would like to set binding for Translation, but I am having hard time. Looking the book WPF in Action I found this code for Rotation. AxisAngleRotation3D angleRot = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0); RotateTransform3D rot = new RotateTransform3D(angleRot,new Point3D(-spaceToUseX + (spaceToUseX / 2), 0, -(barWidth / 2))); Binding rotBind = new Binding("Value"); rotBind.Source = rotateSlider; BindingOperations.SetBinding(angleRot, AxisAngleRotation3D.AngleProperty, rotBind); model.Transform = rot; I wrote this code, but nothing happends.It runs, with no errors Binding TransformBindingX = new Binding("CubeUnit"); TransformBindingX.Path = new PropertyPath("Translate.OffsetX"); Binding TransformBindingY = new Binding("CubeUnit"); TransformBindingY.Path = new PropertyPath("Translate.OffsetY"); Binding TransformBindingZ = new Binding("CubeUnit"); TransformBindingZ.Path = new PropertyPath("Translate.OffsetZ"); TranslateTransform3D translateTransform3D = new TranslateTransform3D(); BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetXProperty, TransformBindingX); BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetYProperty, TransformBindingY); BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetZProperty, TransformBindingZ); Any Idea? Best regards Agha

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups