Hi,
How can I set up the XamZoombar to be used as a date selector? If that's possible, will I then be able to change the "Unittype" in the code behind?
In fact after a bit more digging, I'd like something akin to the finance showcase example but I'd like to be able to select dates, which should be displayed in the zoom bar, instead.
David
The Zoombar doesn’t display dates itself. The Zoombar labels come from the Timeline. I prepared a sample that the upper part of the Timeline is hidden and only the Zoombar is visible. Try using this code:
<UserControl x:Class="Samples.TimelineCompare"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Width="800" Height="300"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ig="http://schemas.infragistics.com/xaml">
<Grid x:Name="LayoutRoot">
<Grid.Resources>
<Style x:Key="LegendStyle" TargetType="ig:TimelineLegend">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
<Style x:Key="SceneStyle" TargetType="ig:Scene">
<Setter Property="Opacity" Value="0" />
</Grid.Resources>
<ig:XamTimeline LegendStyle="{StaticResource LegendStyle}"
SceneStyle="{StaticResource SceneStyle}"
Background="Transparent"
BorderThickness="0"
MinHeight="70"
Height="90">
<ig:XamTimeline.Axis>
<ig:DateTimeAxis Minimum="01/01/2000"
Maximum="01/01/2001"
AutoRange="False" />
</ig:XamTimeline.Axis>
</ig:XamTimeline>
</Grid>
</UserControl>
You are able to change the Timeline axis unit type in the code behind.
According to above post, I have tried to bind Minimum and Maximum property with my ViewModel. but it throws exception "Object Reference Not set to an Instance of an object". if I give this property with hardcoded values as mentioned above, it works perfectly, but after giving hard coded values if I set UnitType from code behind same object refrence error comes. Below is the code snippet which I tried for your reference please.
"<ig:DateTimeAxis ScrollPosition="0.55" ScrollScale=".45" Minimum="01/01/2010" Maximum="01/01/2011" AutoRange="False" x:Name="DateTimeAxis"/>" was written in Xaml file and
DateTimeAxis.UnitType = DateTimeUnitType.Hours; was written in Xaml.cs file
Please let me know if I have done any mistake here, or please provide me solution for the same.
I have investigated the problem. Actually I have modified styles of XamTimeLine and I don't want to dispaly LegendTitle so I have removed LegendElement from Template, due to which it throws error of Object Reference. Now I have set Visibility of LegendElement to "Collapsed" and it works for me.
Thanks for your quick and kind support.
is it possible to send me your project, so I can investigate it asap?
Thanks for the quick reply. I tried with suggested approach but still I am getting same Object Reference Error. Please find following code snippet for your reference please
<
ig:XamTimeline Grid.Row="1" Grid.Column="0" x:Name="Timeline" Margin="10">
<ig:DateTimeAxis ScrollPosition="0.55" ScrollScale=".45" x:Name="DateTimeAxis" Minimum="01/01/2010" Maximum="01/01/2011" AutoRange="False" />
<ig:XamTimeline.Series>
<ig:DateTimeSeries DataMapping="Time=Time;Title=Title;Details=Details"
DataSource="{Binding Path=TimeList}" />
</ig:XamTimeline.Series>
And in the Loaded Event of Xaml.cs file I wrote following suggested code
DateTimeAxis
axis = this.Timeline.Axis as DateTimeAxis;
axis.UnitType =
DateTimeUnitType.Hours;
================================================================
Exception stack trace:
at Infragistics.Controls.Timelines.XamTimeline.ArrangeElements()
at Infragistics.Controls.Timelines.RangeAxis.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at Infragistics.Controls.Timelines.TimelineAxis.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at Infragistics.Controls.Timelines.RangeAxis.OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at Infragistics.Controls.Timelines.DateTimeAxis.set_UnitType(DateTimeUnitType value)
at ViewLoaded(Object sender, RoutedEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
=================================================================
Note : Also I need to bind Minimum and Maximum property of DateTimeAxis class with my viewmodel which is currently hard coded. binding these properties also throws same Object Reference Error
Try changing the UnitType with code like:
DateTimeAxis axis = this.timeline.Axis as DateTimeAxis;
axis.UnitType = DateTimeUnitType.Hours;