C1Scheduler Task-Based Help > C1Scheduler Tasks > Customizing Time Span for Different Views |
Scheduler for WPF and Silverlight enables users to customize the time span for views with visual intervals shorter than a day that includes Day, WorkWeek, Week, and TimeLine views. The C1Scheduler class provides the SmallVisualIntervalScale property (a dependency property as its depends upon VisualIntervalScale property) to set the time span in XAML.
You can set the SmallVisualIntervalScale property to a particular value or bind it with a scheduler element, such as scale, to update the time span whenever the view is changed by the end-user. By default, the SmallVisualIntervalScale property is set to TimeSpan.Zero. Due to this, only VisualScaleInterval property has effect unless SmallVisualIntervalScale property is not set to a value or bound to some element in XAML.
Developers can use this property to apply and preserve custom scaling while switching from one View to another.
The following XAML code snippet shows how to bind SmallVisualIntervalScale property to scale element.
XAML |
Copy Code
|
---|---|
<c1sched:C1Scheduler x:Name="scheduler1" Grid.Column="1" Margin="10 0 0 0" BorderThickness="1" ShowWorkTimeOnly="True" ViewType="Month" SmallVisualIntervalScale="{Binding SelectedItem, ElementName=scale}"> |
Use the following C# code to initialize the scale element in the interaction logic for XAML. The SmallVisualIntervalScale property used in the above code example binds to the scale element initialized in the code given below.
C# |
Copy Code
|
---|---|
// initialize time scale combo
scale.Items.Add(TimeSpan.FromMinutes(10));
scale.Items.Add(TimeSpan.FromMinutes(15));
scale.Items.Add(TimeSpan.FromMinutes(20));
scale.Items.Add(TimeSpan.FromMinutes(30));
scale.Items.Add(TimeSpan.FromMinutes(60));
scale.Items.Add(TimeSpan.FromHours(2));
|