I am trying to find a way to Style the RadScheduleView to remove the border, however, not having too much luck. Attached is a picture, and some pseudo code to share with anyone who as a better idea than I.
Thanks,
HH
public class CustomTimeRulerItemStyleSelector : OrientedTimeRulerItemStyleSelector
{
public Style MinorTickLineStyle
{
get { return m_MinorTickLineStyle; }
set { m_MinorTickLineStyle = value; }
}
private Style m_MinorTickLineStyle;
public Style MajorTickLineStyle
{
get { return m_MajorTickLineStyle; }
set { m_MajorTickLineStyle = value; }
}
private Style m_MajorTickLineStyle;
public override Style SelectStyle(object item, DependencyObject container, ViewDefinitionBase activeViewDeifinition)
{
if (container is TimeRulerLine)
{
TickData tick = item as TickData;
if (tick.Type == TickType.Major)
{
return MajorTickLineStyle;
}
return MinorTickLineStyle;
}
return base.SelectStyle(item, container, activeViewDeifinition);
}
}
<UserControl
x:Class="SilverlightApplication1.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"
xmlns:local="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.ScheduleView"
xmlns:my="clr-namespace:SilverlightApplication1"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d" d:DesignWidth="640" Height="252" >
<UserControl.Resources>
<my:CustomTimeRulerItemStyleSelector x:Key="CustomTimeRulerItemStyleSelector">
<my:CustomTimeRulerItemStyleSelector.MajorTickLineStyle>
<Style TargetType="telerik:TimeRulerLine">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="telerik:TimeRulerLine">
<Border x:Name="LineVisual" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="0 1 0 0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="OrientationStates">
<VisualState x:Name="Horizontal">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LineVisual" Storyboard.TargetProperty="BorderThickness">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Thickness>0 0 0 0</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Vertical" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</my:CustomTimeRulerItemStyleSelector.MajorTickLineStyle>
<my:CustomTimeRulerItemStyleSelector.MinorTickLineStyle>
<Style TargetType="telerik:TimeRulerLine">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="telerik:TimeRulerLine">
<Border x:Name="LineVisual" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="0 1 0 0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="OrientationStates">
<VisualState x:Name="Horizontal">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LineVisual" Storyboard.TargetProperty="BorderThickness">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Thickness>0 0 0 0</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Vertical" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</my:CustomTimeRulerItemStyleSelector.MinorTickLineStyle>
</my:CustomTimeRulerItemStyleSelector>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="#FF242121">
<telerik:RadScheduleView SpecialSlotsSource="{Binding SpecialSlots}"
TimeRulerItemStyleSelector="{StaticResource CustomTimeRulerItemStyleSelector}"
CurrentDate="{Binding ElementName=RadTimeline1, Path=VisiblePeriodStart}"
Height="145" Margin="54,57,64,0"
MinAppointmentHeight="15" Name="theSchedule" NavigationHeaderVisibility="Collapsed"
VerticalAlignment="Top" Background="{x:Null}"
FontSize="10" VerticalScrollBarVisibility="Disabled" >
<telerik:RadScheduleView.ActiveViewDefinition>
<telerik:TimelineViewDefinition MaxTimeRulerExtent="Infinity"
MinTimeRulerExtent="1" ShowTimeRuler="False"
StretchAppointments="False" StretchGroupHeaders="True" />
</telerik:RadScheduleView.ActiveViewDefinition>
</telerik:RadScheduleView>
</Grid>
</UserControl>
Thanks,
HH
public class CustomTimeRulerItemStyleSelector : OrientedTimeRulerItemStyleSelector
{
public Style MinorTickLineStyle
{
get { return m_MinorTickLineStyle; }
set { m_MinorTickLineStyle = value; }
}
private Style m_MinorTickLineStyle;
public Style MajorTickLineStyle
{
get { return m_MajorTickLineStyle; }
set { m_MajorTickLineStyle = value; }
}
private Style m_MajorTickLineStyle;
public override Style SelectStyle(object item, DependencyObject container, ViewDefinitionBase activeViewDeifinition)
{
if (container is TimeRulerLine)
{
TickData tick = item as TickData;
if (tick.Type == TickType.Major)
{
return MajorTickLineStyle;
}
return MinorTickLineStyle;
}
return base.SelectStyle(item, container, activeViewDeifinition);
}
}
<UserControl
x:Class="SilverlightApplication1.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"
xmlns:local="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.ScheduleView"
xmlns:my="clr-namespace:SilverlightApplication1"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d" d:DesignWidth="640" Height="252" >
<UserControl.Resources>
<my:CustomTimeRulerItemStyleSelector x:Key="CustomTimeRulerItemStyleSelector">
<my:CustomTimeRulerItemStyleSelector.MajorTickLineStyle>
<Style TargetType="telerik:TimeRulerLine">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="telerik:TimeRulerLine">
<Border x:Name="LineVisual" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="0 1 0 0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="OrientationStates">
<VisualState x:Name="Horizontal">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LineVisual" Storyboard.TargetProperty="BorderThickness">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Thickness>0 0 0 0</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Vertical" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</my:CustomTimeRulerItemStyleSelector.MajorTickLineStyle>
<my:CustomTimeRulerItemStyleSelector.MinorTickLineStyle>
<Style TargetType="telerik:TimeRulerLine">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="telerik:TimeRulerLine">
<Border x:Name="LineVisual" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="0 1 0 0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="OrientationStates">
<VisualState x:Name="Horizontal">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LineVisual" Storyboard.TargetProperty="BorderThickness">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Thickness>0 0 0 0</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Vertical" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</my:CustomTimeRulerItemStyleSelector.MinorTickLineStyle>
</my:CustomTimeRulerItemStyleSelector>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="#FF242121">
<telerik:RadScheduleView SpecialSlotsSource="{Binding SpecialSlots}"
TimeRulerItemStyleSelector="{StaticResource CustomTimeRulerItemStyleSelector}"
CurrentDate="{Binding ElementName=RadTimeline1, Path=VisiblePeriodStart}"
Height="145" Margin="54,57,64,0"
MinAppointmentHeight="15" Name="theSchedule" NavigationHeaderVisibility="Collapsed"
VerticalAlignment="Top" Background="{x:Null}"
FontSize="10" VerticalScrollBarVisibility="Disabled" >
<telerik:RadScheduleView.ActiveViewDefinition>
<telerik:TimelineViewDefinition MaxTimeRulerExtent="Infinity"
MinTimeRulerExtent="1" ShowTimeRuler="False"
StretchAppointments="False" StretchGroupHeaders="True" />
</telerik:RadScheduleView.ActiveViewDefinition>
</telerik:RadScheduleView>
</Grid>
</UserControl>