Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
225
XamWebTimeline
posted

Hi,

    Is it possible to use the Zoombar in the XamWebTimeline independently ?Please let me know

Regards,

Vijay

  • 30692
    Suggested Answer
    Offline posted

    Someone else may have to comment on whether we officially support using the XamWebZoombar outside of the Timeline control in this version of the software, but its possible, so you can experiment. Here's an example:

    XAML:

    <UserControl x:Class="SilverlightApplication25.MainPage"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

        mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"

        xmlns:igtl="clr-namespace:Infragistics.Silverlight.Timeline;assembly=Infragistics.Silverlight.DataVisualization.Timeline.v9.2"

        xmlns:controls="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.DataVisualization.Controls.v9.2">

     

        <Grid x:Name="LayoutRoot">

            <Grid>

                <Grid.RowDefinitions>

                    <RowDefinition Height="Auto"/>

                    <RowDefinition Height="Auto"/>

                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>

                    <ColumnDefinition Width="Auto"/>

                    <ColumnDefinition Width="Auto"/>

                </Grid.ColumnDefinitions>

                <ScrollViewer x:Name="sview" Width="410"

                              Height="410" HorizontalScrollBarVisibility="Hidden"

                              VerticalScrollBarVisibility="Hidden">

                    <Canvas x:Name="bg" Background="Black" Width="400" Height="400">

                        <Border x:Name="b1" BorderThickness="5"

                                BorderBrush="DarkGray" Width="400"

                                Height="400" Background="Gray">

                            <Border BorderThickness="20" Background="Red" >

                                <Ellipse Fill="Blue" />

                            </Border>

                        </Border>

                    </Canvas>

                </ScrollViewer>

     

                <controls:XamWebZoombar x:Name="Horiz" Grid.Row="1"

                                        Height="40" ZoomChanged="Horiz_ZoomChanged">

                </controls:XamWebZoombar>

                <controls:XamWebZoombar x:Name="Vert" Grid.Column="1" Width="40"

                                        Orientation="Vertical" ZoomChanged="Vert_ZoomChanged">

                </controls:XamWebZoombar>

            </Grid>

        </Grid>

    </UserControl>

    With code behind:

    public partial class MainPage : UserControl

        {

            public MainPage()

            {

                InitializeComponent();

            }

     

            private double _xScale = 1.0;

            private double _yScale = 1.0;

            private double _xPos = 0.0;

            private double _yPos = 0.0;

     

            private void UpdateScroll()

            {

                b1.RenderTransform = new ScaleTransform() { ScaleX = _xScale, ScaleY = _yScale };

                //force scrollable area to adjust since this is render transform.

                bg.Width = 400.0 * _xScale;

                bg.Height = 400.0 * _yScale;

                sview.UpdateLayout();

                sview.ScrollToHorizontalOffset(_xPos * ((400.0 * _xScale) - sview.ViewportWidth));

                sview.ScrollToVerticalOffset(_yPos * ((400.0 * _yScale) - sview.ViewportHeight));

            }

     

            private void Horiz_ZoomChanged(object sender,

                Infragistics.Silverlight.Controls.ZoomChangedEventArgs e)

            {

                _xScale = 1.0 / e.NewRange.Scale;

                _xPos = e.NewRange.Scroll;

     

                UpdateScroll();

            }

     

            private void Vert_ZoomChanged(object sender,

                Infragistics.Silverlight.Controls.ZoomChangedEventArgs e)

            {

                _yScale = 1.0 / e.NewRange.Scale;

                _yPos = e.NewRange.Scroll;

     

                UpdateScroll();

            }

        }

    This sample experiments with using the XamWebZoombar to scroll and scale content in a scrollviewer control.

    -Graham