<
UserControl
xmlns:sdk
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
x:Class
=
"IATRICTestProject.Views.TileView1"
xmlns:tileview
=
"clr-namespace:Telerik.Windows.Controls.TileView;assembly=Telerik.Windows.Controls.Navigation"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"400"
>
<
UserControl.Resources
>
<
DataTemplate
x:Key
=
"CustomerHeaderTemplate"
>
<
TextBlock
Text
=
"{Binding FirstName}"
/>
</
DataTemplate
>
<
tileview:TileToFluideStateConverter
x:Key
=
"tileConverter"
/>
<
Style
TargetType
=
"TextBlock"
x:Key
=
"TextStyle"
>
<
Setter
Property
=
"FontSize"
Value
=
"12"
/>
<
Setter
Property
=
"FontFamily"
Value
=
"Verdana"
/>
</
Style
>
<
Style
TargetType
=
"TextBlock"
x:Key
=
"TitleTextStyle"
BasedOn
=
"{StaticResource TextStyle}"
>
<
Setter
Property
=
"FontWeight"
Value
=
"Bold"
/>
</
Style
>
<
DataTemplate
x:Key
=
"CustomerTemplate"
>
<
telerik:RadFluidContentControl
ContentChangeMode
=
"Manual"
TransitionDuration
=
"0:0:.5"
SmallToNormalThreshold
=
"400 400"
NormalToSmallThreshold
=
"400 400"
NormalToLargeThreshold
=
"600 600"
LargeToNormalThreshold
=
"600 600"
State
=
"{Binding State, Converter={StaticResource tileConverter}}"
>
<
telerik:RadFluidContentControl.SmallContent
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10"
>
<
TextBlock
Text
=
"First Name:"
/>
<
TextBlock
Text
=
"{Binding FirstName}"
/>
</
StackPanel
>
</
telerik:RadFluidContentControl.SmallContent
>
<
telerik:RadFluidContentControl.Content
>
<
telerik:RadWrapPanel
Margin
=
"20"
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10"
>
<
TextBlock
Text
=
"First Name:"
/>
<
TextBlock
Text
=
"{Binding FirstName}"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10"
>
<
TextBlock
Text
=
"Company Name:"
/>
<
TextBlock
Text
=
"{Binding CompanyName}"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10"
>
<
TextBlock
Text
=
"Email ID:"
/>
<
TextBlock
Text
=
"{Binding EmailAddress}"
/>
</
StackPanel
>
</
telerik:RadWrapPanel
>
</
telerik:RadFluidContentControl.Content
>
<
telerik:RadFluidContentControl.LargeContent
>
<
Grid
Width
=
"600"
Height
=
"600"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"*"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<!--<
Image
Source
=
"../Images/TileView/Flags/map.png"
Grid.ColumnSpan
=
"2"
Grid.RowSpan
=
"2"
/>
<
Image
Source
=
"{Binding LargeFlag}"
Grid.Column
=
"1"
Margin
=
"10"
/>-->
<
telerik:RadWrapPanel
Margin
=
"20"
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10"
>
<
TextBlock
Text
=
"First Name:"
/>
<
TextBlock
Text
=
"{Binding FirstName}"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10"
>
<
TextBlock
Text
=
"Last Name:"
/>
<
TextBlock
Text
=
"{Binding LastName}"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10"
>
<
TextBlock
Text
=
"Company Name:"
/>
<
TextBlock
Text
=
"{Binding CompanyName}"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10"
>
<
TextBlock
Text
=
"Email ID:"
/>
<
TextBlock
Text
=
"{Binding EmailAddress}"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10"
>
<
TextBlock
Text
=
"Phone:"
/>
<
TextBlock
Text
=
"{Binding Phone}"
/>
</
StackPanel
>
</
telerik:RadWrapPanel
>
<
TextBlock
FontSize
=
"11"
TextWrapping
=
"Wrap"
Text
=
"{Binding EmailAddress}"
Grid.Row
=
"1"
Grid.ColumnSpan
=
"2"
Margin
=
"20"
/>
</
Grid
>
</
telerik:RadFluidContentControl.LargeContent
>
</
telerik:RadFluidContentControl
>
</
DataTemplate
>
<
Style
TargetType
=
"telerik:RadTileView"
>
<
Setter
Property
=
"PreservePositionWhenMaximized"
Value
=
"True"
/>
<
Setter
Property
=
"telerik:TileViewPanel.IsVirtualized"
Value
=
"True"
/>
<
Setter
Property
=
"IsAutoScrollingEnabled"
Value
=
"True"
/>
<
Setter
Property
=
"TileStateChangeTrigger"
Value
=
"SingleClick"
/>
<
Setter
Property
=
"MinimizedColumnWidth"
Value
=
"180"
/>
<
Setter
Property
=
"MinimizedRowHeight"
Value
=
"155"
/>
<
Setter
Property
=
"RowHeight"
Value
=
"155"
/>
<
Setter
Property
=
"ColumnWidth"
Value
=
"180"
/>
<
Setter
Property
=
"ColumnsCount"
Value
=
"5"
/>
<
Setter
Property
=
"ContentTemplate"
Value
=
"{StaticResource CustomerTemplate}"
/>
<
Setter
Property
=
"ItemTemplate"
Value
=
"{StaticResource CustomerHeaderTemplate}"
/>
</
Style
>
</
UserControl.Resources
>
<
Border
CornerRadius
=
"6"
>
<
telerik:RadTileView
x:Name
=
"radTileView"
TileStateChanged
=
"tileView1_TileStateChanged"
TileStateChangeTrigger
=
"SingleClick"
IsItemDraggingEnabled
=
"True"
PreservePositionWhenMaximized
=
"True"
>
</
telerik:RadTileView
>
</
Border
>
</
UserControl
>
And here is my XAML.CS file
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Net;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Documents;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Animation;
using
System.Windows.Shapes;
using
IATRICTestProject.Web;
using
Telerik.Windows.Controls;
namespace
IATRICTestProject.Views
{
public
partial
class
TileView1 : UserControl
{
public
TileView1()
{
InitializeComponent();
Loaded +=
new
RoutedEventHandler(TileView1_Loaded);
}
void
TileView1_Loaded(
object
sender, RoutedEventArgs e)
{
try
{
AdventureWorksDomainContext ctx =
new
AdventureWorksDomainContext();
this
.radTileView.ItemsSource = ctx.Customers;
ctx.Load(ctx.GetCustomerQuery());
}
catch
(Exception ex)
{
}
}
private
void
RadTileView_TileStateChanged(
object
sender, Telerik.Windows.RadRoutedEventArgs e)
{
}
private
void
tileView1_TileStateChanged(
object
sender, Telerik.Windows.RadRoutedEventArgs e)
{
try
{
e.Handled =
true
;
RadTileViewItem item = e.OriginalSource
as
RadTileViewItem;
if
(item !=
null
)
{
var fluidControls = item.ChildrenOfType<RadFluidContentControl>();
if
(fluidControls.Count == 0)
{
return
;
}
RadFluidContentControl fluidControl = fluidControls[0];
switch
(item.TileState)
{
case
TileViewItemState.Maximized:
fluidControl.State = FluidContentControlState.Large;
break
;
case
TileViewItemState.Minimized:
fluidControl.State = FluidContentControlState.Small;
break
;
case
TileViewItemState.Restored:
fluidControl.State = FluidContentControlState.Normal;
break
;
}
}
}
catch
(Exception ex) { }
}
}
}