I am trying to build this control into an application but am finding the zoom bar at the bottom is not really meeting our needs. Perhaps with some extra code it could but the documentation is sparse and hard to figure out.
I need to be able display events, perhaps years apart. This works fine. But then i want to zoom in on an event and see it's timeline on a scale of perhaps minutes. The scroller at the bottom does not allow you to zoom in so close. I have had a bit of luck playing with the ScrollScale but cannot really control it yet to zoom into the desired area.
Perhaps related, it seems it would be nice to hook up the mouse wheel to the zoom function but i also have had no luck in doing this.
My application is windows forms and so i am using System.Windows.Forms.Integration.ElementHost on my windows form. I have created a WPF User control using XAML to hold the xamTimeline. Would have used a windows form control if it existed but i do not see one listed in the products.
Hi,
You can try using this code:
<ig:XamTimeline x:Name="Timeline" MouseWheel="XamTimeline_MouseWheel">
</ig:XamTimeline>
…
private void XamTimeline_MouseWheel(object sender, MouseWheelEventArgs e)
{
double scale = 1 + Math.Min(0.5, Math.Max(-0.5, e.Delta / 1200.0));
this.Timeline.Axis.ScrollScale *= scale;
}
thanks for that. I have tried and thus far am unable to get this event to fire. I tried several variations on this code after translating to VB.net. As you wil see this is in a UserControl. That in turn is in a Windows.Forms.UserControl. But the event does not even get to the first step.
Private Sub XamTimeline1_MouseWheel(sender As System.Object, e As System.Windows.Input.MouseWheelEventArgs) Handles XamTimeline1.MouseWheel, MyBase.MouseWheel ' this one never fires Dim scale As Double = 1 + Math.Min(0.5, Math.Max(-0.5, e.Delta / 1200.0)) XamTimeline1.Axis.ScrollScale *= scaleEnd Sub
'Private Sub XamTimeline1_MouseMove(sender As System.Object, e As System.Windows.Input.MouseEventArgs) Handles XamTimeline1.MouseMove Private Sub XamTimeline1_MouseMove(sender As System.Object, e As System.Windows.Input.MouseEventArgs) ' this one fires ok End Sub
<UserControl x:Class="WpfTimelineUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:igtl="http://schemas.infragistics.com/xaml" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="480" xmlns:ig="http://schemas.infragistics.com/xaml"> <Grid> <ig:XamTimeline HorizontalAlignment="Stretch" Name="XamTimeline1" VerticalAlignment="Top" MouseWheel="XamTimeline1_MouseWheel" > <ig:XamTimeline.Axis> <ig:DateTimeAxis ScrollPosition=".5" ScrollScale=".45" /> <!--The properties ScrollPosition and ScrollScale set the initial position of the xamWebZoombar control--> </ig:XamTimeline.Axis> </ig:XamTimeline> </Grid>
In my sample, I need to click on the Timeline first to get MouseWheel event fired. Did you try this?
I recieve XamTimeline1_MouseMove, even if i click on some other control and then move over the timeline.
I do NOT recieve XamTimeline1_MouseWheel, even if i first click on the timeline.
Below are some code fragments.
Also note that the timeline control is within a UserControl but i dont see why this would effect things.
Private Sub XamTimeline1_MouseMove(sender As System.Object, e As System.Windows.Input.MouseEventArgs) ' this one fires ok End Sub
Private Sub XamTimeline1_MouseWheel(sender As System.Object, e As System.Windows.Input.MouseWheelEventArgs) Handles XamTimeline1.MouseWheel, MyBase.MouseWheel ' this one never fires Dim scale As Double = 1 + Math.Min(0.5, Math.Max(-0.5, e.Delta / 1200.0)) XamTimeline1.Axis.ScrollScale *= scale End Sub
<UserControl x:Class="WpfTimelineUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:igtl="http://schemas.infragistics.com/xaml" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="480" xmlns:ig="http://schemas.infragistics.com/xaml"> <Grid> <ig:XamTimeline HorizontalAlignment="Stretch" Name="XamTimeline1" VerticalAlignment="Top" MouseWheel="XamTimeline1_MouseWheel" MouseMove="XamTimeline1_MouseMove"> <ig:XamTimeline.Axis> <ig:DateTimeAxis ScrollPosition=".5" ScrollScale=".45" /> <!--The properties ScrollPosition and ScrollScale set the initial position of the xamWebZoombar control--> </ig:XamTimeline.Axis> </ig:XamTimeline> </Grid>
It’s probably something related to using WPF in WinForms. Is it possible to send me a small sample, so I can look at it?