This project is read-only.

Zooming on UIElement in _elementFlow.Children

Jun 18, 2008 at 8:10 PM
Hi

I've setup the ElementFlow demo to handle the mouse down event and I'm trying to zoom in on the selected UIElement.

I'm using the following line of code to isolate the UIElement and then apply a Scale Transform

_elementFlow.Children[_elementFlow.SelectedIndex].RenderTransform =

new ScaleTransform(3.0, 3.0);

but it does not increase the size of the element.

I tested about a bit and I can apply the scale transform to the _elementFlow control but none of the UIElements contained within the _elementFlow.Children UIElementCollection

any ideas?

 

Jun 19, 2008 at 7:20 PM
Hi Kevdel,
    The visual items of ElementFlow are instances of ModelUIElement3D. You can set the ScaleTransform3D instead of the ScaleTransform to get your desired effect.
Jun 19, 2008 at 8:21 PM
Hi Pavanpodila

i tried the following to apply the transform

((

UIElement3D) _elementFlow.Children[_elementFlow.SelectedIndex]).Transform = new ScaleTransform3D(2.0, 2.0, 2.0);

but i get the following

Error 1 Cannot convert type 'System.Windows.UIElement' to 'System.Windows.UIElement3D' C:\ElementFlowDemo\ElementFlowDemo\Window1.xaml.cs 101 12 ElementFlowDemo

I'm missing something.. can you shed some light on this?

 

Jun 19, 2008 at 10:18 PM

I think the problem is that ElementFlow doesn't by default give you the ability to get down to the 3D model.  I ran into that when attempting to capture mouse clicks on the items.

http://www.codeplex.com/fluidkit/Thread/View.aspx?ThreadId=29566

Inside ElementFlow.cs I made the following modification -

public Visual3DCollection Visual3DCollection
{
        get { return _modelContainer.Children; }
}

This exposes what you need to do something like...

 

 

void _elementFlow_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
        ModelUIElement3D model = e.Source as ModelUIElement3D;
        if (model != null)
        {

                _elementFlow.Visual3DCollection[_elementFlow.Visual3DCollection.IndexOf(model)].Transform = new ScaleTransform3D(2.0, 2.0, 2.0);
        }
}

I'm not sure what Pavan has planned to resolve this in future releases, but this should get you going for now.  (I think)

Jun 20, 2008 at 6:44 PM
perfect.. thank you sir!