Hi,
I am using the carousel control to implement a media center like menu for my application. The main menu items should scroll vertically with the current item in the centre and the sub items should then appear below it and be chooseable. The priority is on easy keyboard navigation.
The problems I am facing are:
1) Styling the carousel seems to be incredibly difficult. Just having the main menu item description with a list of sub items is even difficult to do. Adding additional elements to the data template seems to stop the sub items from rendering.
2) Keyboard navigation does not work correctly. I'd like the main menu to scroll on Up / Down and the sub menu to scroll on Left / Right. Unfortunately, only the currently focused carousel panel will scroll and it then scrolls on all arrow key presses.
The control seems to have such a steep learning curve that I'm tempted to ditch it and write my own custom control - albeit without some of the nice scrolling effects that your control brings.
I've attached my attempt below, it is based on a sample I saw on this site. Any help would be appreciated.
I am using the carousel control to implement a media center like menu for my application. The main menu items should scroll vertically with the current item in the centre and the sub items should then appear below it and be chooseable. The priority is on easy keyboard navigation.
The problems I am facing are:
1) Styling the carousel seems to be incredibly difficult. Just having the main menu item description with a list of sub items is even difficult to do. Adding additional elements to the data template seems to stop the sub items from rendering.
2) Keyboard navigation does not work correctly. I'd like the main menu to scroll on Up / Down and the sub menu to scroll on Left / Right. Unfortunately, only the currently focused carousel panel will scroll and it then scrolls on all arrow key presses.
The control seems to have such a steep learning curve that I'm tempted to ditch it and write my own custom control - albeit without some of the nice scrolling effects that your control brings.
I've attached my attempt below, it is based on a sample I saw on this site. Any help would be appreciated.
<
UserControl.Resources
>
<
Path
x:Key
=
"horizontalPath"
Stretch
=
"None"
Opacity
=
"1"
Data
=
"M0,0 C0,0 0,800 0,800"
Stroke
=
"#FFB4B4B4"
StrokeThickness
=
"4"
>
</
Path
>
<
DataTemplate
DataType
=
"{x:Type local:Message}"
>
<
telerik:CarouselScrollViewer
CanContentScroll
=
"True"
HorizontalScrollBarVisibility
=
"Hidden"
VerticalScrollBarVisibility
=
"Hidden"
>
<!-- putting in a header here stops the child panel from rendering correctly -->
<
telerik:RadCarouselPanel
Loaded
=
"RadCarouselPanel_Loaded"
CanVerticallyScroll
=
"False"
TopContainerChanged
=
"RadCarouselPanel_TopContainerChanged_1"
>
<
Button
Content
=
"menu1"
/>
<
Button
Content
=
"menu2"
/>
<
Button
Content
=
"menu3"
/>
<
Button
Content
=
"menu4"
/>
<
Button
Content
=
"menu5"
/>
<
Button
Content
=
"menu6"
/>
</
telerik:RadCarouselPanel
>
</
telerik:CarouselScrollViewer
>
</
DataTemplate
>
<
Style
TargetType
=
"{x:Type telerik:CarouselItem}"
>
<
Setter
Property
=
"MaxHeight"
Value
=
"1000"
/>
<
Setter
Property
=
"MaxWidth"
Value
=
"1000"
/>
<
Setter
Property
=
"Height"
Value
=
"200"
/>
<
Setter
Property
=
"Width"
Value
=
"400"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:CarouselItem"
>
<
Border
x:Name
=
"mainBorder"
>
<
Border
Opacity
=
"1"
BorderBrush
=
"#3F000000"
BorderThickness
=
"1,1,1,1"
CornerRadius
=
"5,5,5,5"
Margin
=
"10,10,10,10"
x:Name
=
"CarouselItemInnerBorder"
SnapsToDevicePixels
=
"True"
>
<
Border.Background
>
<
LinearGradientBrush
EndPoint
=
"101,462"
StartPoint
=
"101,13"
MappingMode
=
"Absolute"
>
<
GradientStop
Color
=
"#FF2C3A68"
Offset
=
"0"
/>
<
GradientStop
Color
=
"#FF000000"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#FF0F224C"
Offset
=
"0.045"
/>
<
GradientStop
Color
=
"#FF000000"
Offset
=
"0.0451"
/>
</
LinearGradientBrush
>
</
Border.Background
>
<
ContentPresenter
IsHitTestVisible
=
"True"
/>
</
Border
>
</
Border
>
<
ControlTemplate.Triggers
>
<!-- IsSelected does not appear to fire -->
<
Trigger
Property
=
"IsSelected"
Value
=
"True"
>
<
Setter
TargetName
=
"CarouselItemInnerBorder"
Property
=
"Background"
>
<
Setter.Value
>
<
LinearGradientBrush
EndPoint
=
"108,472"
StartPoint
=
"108,23"
MappingMode
=
"Absolute"
>
<
GradientStop
Color
=
"#FF344B97"
Offset
=
"0"
/>
<
GradientStop
Color
=
"#FF000000"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#FF233F7E"
Offset
=
"0.045"
/>
<
GradientStop
Color
=
"#FF000000"
Offset
=
"0.0451"
/>
</
LinearGradientBrush
>
</
Setter.Value
>
</
Setter
>
</
Trigger
>
</
ControlTemplate.Triggers
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
UserControl.Resources
>
<
Grid
>
<
telerik:RadCarousel
x:Name
=
"radCarousel"
AutoGenerateDataPresenters
=
"False"
Loaded
=
"radCarousel_Loaded"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
HorizontalScrollBarVisibility
=
"Hidden"
VerticalScrollBarVisibility
=
"Hidden"
>
<
telerik:RadCarousel.ItemsPanel
>
<
ItemsPanelTemplate
>
<
telerik:RadCarouselPanel
x:Name
=
"radCarouselPanel"
IsScalingEnabled
=
"True"
IsOpacityEnabled
=
"False"
CanHorizontallyScroll
=
"False"
TopContainerChanged
=
"RadCarouselPanel_TopContainerChanged"
>
</
telerik:RadCarouselPanel
>
</
ItemsPanelTemplate
>
</
telerik:RadCarousel.ItemsPanel
>
</
telerik:RadCarousel
>
</
Grid
>
</
UserControl
>