or
<
Window
x:Class
=
"CarouselTest2.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local
=
"clr-namespace:CarouselTest2"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Window.Resources
>
<
DataTemplate
DataType
=
"{x:Type local:Item}"
>
<
Border
BorderBrush
=
"Black"
BorderThickness
=
"2"
CornerRadius
=
"5"
>
<
Grid
>
<
Label
Content
=
"{Binding Path=Value}"
/>
</
Grid
>
</
Border
>
</
DataTemplate
>
</
Window.Resources
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
TextBox
x:Name
=
"txtBox"
Grid.Row
=
"0"
TextChanged
=
"TextBox_TextChanged"
/>
<
telerik:RadCarousel
x:Name
=
"Carousel"
Grid.Row
=
"1"
Focusable
=
"False"
AutoGenerateDataPresenters
=
"False"
HorizontalScrollBarVisibility
=
"Hidden"
VerticalScrollBarVisibility
=
"Visible"
>
<
telerik:RadCarousel.ItemsPanel
>
<
ItemsPanelTemplate
>
<
telerik:RadCarouselPanel
ItemsPerPage
=
"7"
IsOpacityEnabled
=
"False"
PathPadding
=
"0"
>
<!--<
telerik:RadCarouselPanel.Path
>
<
Path
Stretch
=
"Fill"
>
<
Path.Data
>
<
LineGeometry
StartPoint
=
"0, 800"
EndPoint
=
"0, 10"
/>
</
Path.Data
>
</
Path
>
</
telerik:RadCarouselPanel.Path
>-->
</
telerik:RadCarouselPanel
>
</
ItemsPanelTemplate
>
</
telerik:RadCarousel.ItemsPanel
>
</
telerik:RadCarousel
>
</
Grid
>
</
Window
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Data;
using
System.Windows.Documents;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Imaging;
using
System.Windows.Navigation;
using
System.Windows.Shapes;
using
System.Collections;
namespace
CarouselTest2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
ListCollectionView view;
public
MainWindow()
{
InitializeComponent();
List<Item> Items =
new
List<Item>();
for
(
int
i = 0; i < 150; i++)
{
Items.Add(
new
Item(i));
}
view =
new
ListCollectionView(Items.ToList());
view.Filter =
new
Predicate<
object
>(FilterObject);
this
.Carousel.ItemsSource = view;
}
private
bool
FilterObject(
object
itemToFilter)
{
if
(itemToFilter ==
null
)
return
false
;
String filterText =
this
.txtBox.Text.ToUpper();
if
(filterText.Length == 0)
return
true
;
return
((itemToFilter
as
Item).Value.ToString().Contains(filterText));
}
private
void
TextBox_TextChanged(
object
sender, TextChangedEventArgs e)
{
this
.view.Refresh();
this
.Carousel.BringDataItemIntoView(
this
.view.CurrentItem);
}
}
public
class
Item
{
public
Item(
int
i)
{
this
.Value = i;
}
public
int
Value {
get
;
set
; }
}
}
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Period}"
Header
=
"Period"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding PeriodFormatted}"
/>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
<
telerik:GridViewColumn.CellEditTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding Path=PeriodFormatted, Mode=TwoWay}"
/>
</
DataTemplate
>
</
telerik:GridViewColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
public string PeriodFormatted
{
get { return Period.PeriodToString(); }
set
{
Period = value.StringToPeriod(ContractHeader.Date);
SendPropertyChanged("PeriodFormatted");
}
}