or
<
ResourceDictionary
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
>
<
SolidColorBrush
x:Key
=
"TileView_Background"
Color
=
"#FFFFFFFF"
/>
<!-- Resource dictionary entries should be defined here. -->
<
SolidColorBrush
x:Key
=
"TileView_OuterBorder"
Color
=
"#FF848484"
/>
<
SolidColorBrush
x:Key
=
"TileView_InneBorder"
Color
=
"#FFFFFFFF"
/>
<
Thickness
x:Key
=
"TileView_InneBorder_Thickness"
>1</
Thickness
>
<
SolidColorBrush
x:Key
=
"TileView_HeaderBorder"
Color
=
"#FFFFFFFF"
/>
<
Thickness
x:Key
=
"TileView_HeaderBorder_Thickness"
>0 0 0 1</
Thickness
>
<
LinearGradientBrush
x:Key
=
"TileView_HeaderBackground"
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#78C3B8"
/>
<
GradientStop
Color
=
"#96C4BE"
Offset
=
"1"
/>
</
LinearGradientBrush
>
<
LinearGradientBrush
x:Key
=
"TileView_ButtonBackground"
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#000000"
/>
<
GradientStop
Color
=
"#000000"
Offset
=
"1"
/>
</
LinearGradientBrush
>
<
SolidColorBrush
x:Key
=
"TileView_ButtonOuterBorder"
Color
=
"White"
/>
<
LinearGradientBrush
x:Key
=
"TileView_ButtonBackground_MouseOver"
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#78C3B8"
Offset
=
"0"
/>
<
GradientStop
Color
=
"#78C3B8"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#96C4BE"
Offset
=
"0.526"
/>
<
GradientStop
Color
=
"#96C4BE"
Offset
=
"0.509"
/>
</
LinearGradientBrush
>
<
LinearGradientBrush
x:Key
=
"TileView_ButtonBackground_Pressed"
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#FFFECE95"
Offset
=
"0"
/>
<
GradientStop
Color
=
"#FFFEB407"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#FFFEBB6E"
Offset
=
"0.517"
/>
<
GradientStop
Color
=
"#FFE78318"
Offset
=
"0.539"
/>
</
LinearGradientBrush
>
<
CornerRadius
x:Key
=
"TileView_HeaderBorder_CornerRadius"
>2</
CornerRadius
>
<
SolidColorBrush
x:Key
=
"TileView_HeaderBorder_HorizontalSplitterBackground"
Color
=
"#47B5A3"
/>
<
LinearGradientBrush
x:Key
=
"TileView_HeaderBorder_HorizontalSplitterOpacityMask"
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"Black"
Offset
=
"0"
/>
<
GradientStop
Offset
=
"1"
/>
</
LinearGradientBrush
>
<
SolidColorBrush
x:Key
=
"DisabledBrush"
Color
=
"#99FFFFFF"
/>
<
CornerRadius
x:Key
=
"TileView_InneBorder_CornerRadius"
>8</
CornerRadius
>
<
CornerRadius
x:Key
=
"TileView_OuterBorder_CornerRadius"
>5</
CornerRadius
>
<
Style
TargetType
=
"telerik:RadTileViewItem"
>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"VerticalContentAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"Background"
Value
=
"{StaticResource TileView_Background}"
/>
<
Setter
Property
=
"BorderBrush"
Value
=
"{StaticResource TileView_OuterBorder}"
/>
<
Setter
Property
=
"BorderThickness"
Value
=
"1"
/>
<
Setter
Property
=
"Padding"
Value
=
"7"
/>
<
Setter
Property
=
"TileState"
Value
=
"Restored"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:RadTileViewItem"
>
<
Grid
>
<
VisualStateManager.VisualStateGroups
>
<
VisualStateGroup
x:Name
=
"CommonStates"
>
<
VisualState
x:Name
=
"Normal"
/>
<
VisualState
x:Name
=
"Disabled"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"DisabledVisual"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"Visible"
/>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"MouseOver"
/>
</
VisualStateGroup
>
</
VisualStateManager.VisualStateGroups
>
<
Border
BorderBrush
=
"{TemplateBinding BorderBrush}"
BorderThickness
=
"{TemplateBinding BorderThickness}"
Background
=
"{TemplateBinding Background}"
CornerRadius
=
"{StaticResource TileView_OuterBorder_CornerRadius}"
Margin
=
"{TemplateBinding Padding}"
>
<
Border
BorderBrush
=
"{StaticResource TileView_InneBorder}"
BorderThickness
=
"{StaticResource TileView_InneBorder_Thickness}"
CornerRadius
=
"{StaticResource TileView_InneBorder_CornerRadius}"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
ContentPresenter
x:Name
=
"ContentElement"
ContentTemplate
=
"{TemplateBinding ContentTemplate}"
Content
=
"{TemplateBinding Content}"
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
Grid.Row
=
"1"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
/>
<
Grid
x:Name
=
"ContentCacheHost"
Grid.Row
=
"1"
/>
<
StackPanel
>
<
Border
BorderBrush
=
"{StaticResource TileView_HeaderBorder}"
BorderThickness
=
"{StaticResource TileView_HeaderBorder_Thickness}"
CornerRadius
=
"{StaticResource TileView_HeaderBorder_CornerRadius}"
Padding
=
"10 0 7 0"
>
<
Border.Background
>
<
LinearGradientBrush
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#69AEA4"
/>
<
GradientStop
Color
=
"#96C4BE"
Offset
=
"1"
/>
</
LinearGradientBrush
>
</
Border.Background
>
<
Grid
MinHeight
=
"28"
>
<
Border
x:Name
=
"GripBarElement"
Background
=
"Transparent"
>
<
ContentPresenter
x:Name
=
"HeaderElement"
ContentTemplate
=
"{TemplateBinding HeaderTemplate}"
HorizontalAlignment
=
"Left"
Margin
=
"0,0,10,0"
VerticalAlignment
=
"Center"
/>
</
Border
>
<
ToggleButton
x:Name
=
"MaximizeToggleButton"
HorizontalAlignment
=
"Right"
Height
=
"17"
VerticalAlignment
=
"Center"
Width
=
"17"
>
<
ToggleButton.Template
>
<
ControlTemplate
TargetType
=
"ToggleButton"
>
<
Grid
>
<
VisualStateManager.VisualStateGroups
>
<
VisualStateGroup
x:Name
=
"FocusStates"
>
<
VisualState
x:Name
=
"Focused"
/>
<
VisualState
x:Name
=
"Unfocused"
/>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"CommonStates"
>
<
VisualState
x:Name
=
"Disabled"
/>
<
VisualState
x:Name
=
"Normal"
/>
<
VisualState
x:Name
=
"MouseOver"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty
=
"Fill"
Storyboard.TargetName
=
"RestoreIcon"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource TileView_ButtonBackground_MouseOver}"
/>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty
=
"Fill"
Storyboard.TargetName
=
"CollapseIcon"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource TileView_ButtonBackground_MouseOver}"
/>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Pressed"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty
=
"Fill"
Storyboard.TargetName
=
"RestoreIcon"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource TileView_ButtonBackground_Pressed}"
/>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty
=
"Fill"
Storyboard.TargetName
=
"CollapseIcon"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource TileView_ButtonBackground_Pressed}"
/>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"CheckStates"
>
<
VisualState
x:Name
=
"Checked"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"Restore"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Collapsed</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"Collapse"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Unchecked"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"Restore"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"Collapse"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Collapsed</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Indeterminate"
/>
</
VisualStateGroup
>
</
VisualStateManager.VisualStateGroups
>
<
Grid
x:Name
=
"Restore"
Background
=
"Transparent"
Height
=
"13"
Width
=
"13"
>
<
ToolTipService.ToolTip
>
<
ToolTip
telerik:LocalizationManager.ResourceKey
=
"TileViewItemMaximizeText"
/>
</
ToolTipService.ToolTip
>
<
Path
x:Name
=
"RestoreIcon"
Data
=
"M2,5 L2,8.9999999 6,8.9999999 6,5 z M0,3 L8,3 8,5 8,8.9999999 8,11 0,11 0,8.9999999 0,5 z M3,0 L11,0 11,2 11,8.9999999 9,8.9999999 9,2 3,2 z"
Fill
=
"{StaticResource TileView_ButtonBackground}"
Margin
=
"1"
Stretch
=
"Fill"
Stroke
=
"{x:Null}"
StrokeThickness
=
"0.5"
/>
<
Path
Data
=
"M1,12 L9,12 9,13 1,13 z M3.9999999,7 L3.9999999,9 6,9 6,7 z M3,6 L7,6 7,7 7,9 7,10 3,10 3,9 3,7 z M0,4 L1,4 1,12 0,12 z M12,1 L13,1 13,10 12,10 z M3,1 L3.9999999,1 3.9999999,3 10,3 10,4 10,10 12,10 12,11 10,11 10,12 9,12 9,4 1,4 1,3 3,3 z M3.9999999,0 L12,0 12,1 3.9999999,1 z"
Fill
=
"{StaticResource TileView_ButtonOuterBorder}"
Stretch
=
"Fill"
Stroke
=
"{x:Null}"
StrokeThickness
=
"0.5"
/>
</
Grid
>
<
Grid
x:Name
=
"Collapse"
Background
=
"Transparent"
Height
=
"5"
Visibility
=
"Collapsed"
Width
=
"12"
>
<
ToolTipService.ToolTip
>
<
ToolTip
telerik:LocalizationManager.ResourceKey
=
"TileViewItemMinimizeText"
/>
</
ToolTipService.ToolTip
>
<
Rectangle
Fill
=
"{StaticResource TileView_ButtonOuterBorder}"
Stroke
=
"{x:Null}"
StrokeThickness
=
"0.5"
/>
<
Rectangle
x:Name
=
"CollapseIcon"
Fill
=
"{StaticResource TileView_ButtonBackground}"
Margin
=
"1"
Stroke
=
"{x:Null}"
StrokeThickness
=
"0.5"
/>
</
Grid
>
</
Grid
>
</
ControlTemplate
>
</
ToggleButton.Template
>
</
ToggleButton
>
</
Grid
>
</
Border
>
<
Border
x:Name
=
"Splitter"
BorderThickness
=
"0"
Background
=
"{StaticResource TileView_HeaderBorder_HorizontalSplitterBackground}"
Height
=
"4"
OpacityMask
=
"{StaticResource TileView_HeaderBorder_HorizontalSplitterOpacityMask}"
/>
</
StackPanel
>
<
Rectangle
x:Name
=
"DisabledVisual"
Fill
=
"{StaticResource DisabledBrush}"
RadiusY
=
"4"
RadiusX
=
"4"
Grid.RowSpan
=
"2"
Visibility
=
"Collapsed"
/>
</
Grid
>
</
Border
>
</
Border
>
</
Grid
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
ResourceDictionary
>
<
Window
x:Class
=
"TileTest.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
WindowStartupLocation
=
"CenterScreen"
>
<
Window.Resources
>
<
DataTemplate
x:Key
=
"ItemTemplate"
>
<
TextBlock
Text
=
"{Binding}"
/>
</
DataTemplate
>
<
DataTemplate
x:Key
=
"ContentTemplate"
>
<
telerik:RadFluidContentControl
>
<
telerik:RadFluidContentControl.SmallContent
>
<
TextBlock
Text
=
"small"
/>
</
telerik:RadFluidContentControl.SmallContent
>
<
telerik:RadFluidContentControl.Content
>
<
TextBlock
Text
=
"default"
/>
</
telerik:RadFluidContentControl.Content
>
<
telerik:RadFluidContentControl.LargeContent
>
<
TextBlock
Text
=
"large"
/>
</
telerik:RadFluidContentControl.LargeContent
>
</
telerik:RadFluidContentControl
>
</
DataTemplate
>
</
Window.Resources
>
<
Grid
>
<
telerik:RadTileView
x:Name
=
"radTileView"
ContentTemplate
=
"{StaticResource ContentTemplate}"
ItemTemplate
=
"{StaticResource ItemTemplate}"
MinimizedColumnWidth
=
"200"
MinimizedRowHeight
=
"200"
PreservePositionWhenMaximized
=
"True"
IsVirtualizing
=
"True"
/>
</
Grid
>
</
Window
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Windows;
namespace
TileTest
{
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
InitializeComponent();
var data =
new
List<
string
>();
foreach
(var num
in
Enumerable.Range(1, 12))
{
data.Add(String.Format(
"Item {0}"
, num));
}
this
.radTileView.ItemsSource = data;
}
}
}
City County State
--------- --------- ---------
City1 County1 State1
City1 County2 State1
City2 County3 State2
City3 County4 State3
01.
<
DataTemplate
x:Key
=
"ComboBoxCustomTemplate"
>
02.
<
Grid
Margin
=
"0,2,0,2"
>
03.
<
Grid.ColumnDefinitions
>
04.
<
ColumnDefinition
/>
05.
<
ColumnDefinition
/>
06.
</
Grid.ColumnDefinitions
>
07.
<
Grid.RowDefinitions
>
08.
<
RowDefinition
/>
09.
<
RowDefinition
/>
10.
</
Grid.RowDefinitions
>
11.
<
TextBlock
TextAlignment
=
"Left"
Grid.ColumnSpan
=
"2"
Text
=
"{Binding City}"
/>
12.
<
StackPanel
Grid.Row
=
"1"
Grid.Column
=
"0"
Orientation
=
"Horizontal"
>
13.
<
TextBlock
Text
=
"County: "
/>
14.
<
TextBlock
Foreground
=
"Blue"
Text
=
"{Binding County}"
/>
15.
</
StackPanel
>
16.
<
StackPanel
Grid.Row
=
"1"
Grid.Column
=
"1"
Orientation
=
"Horizontal"
>
17.
<
TextBlock
Text
=
"State: "
/>
18.
<
TextBlock
Foreground
=
"Blue"
Text
=
"{Binding State}"
/>
19.
</
StackPanel
>
20.
</
Grid
>
21.
</
DataTemplate
>
1.
<
telerik:RadComboBox
2.
IsEditable
=
"True"
3.
StaysOpenOnEdit
=
"True"
4.
ItemsSource
=
"{Binding Path=CitiesCountiesStates}"
5.
SelectedItem
=
"{Binding Path=SelectedCityCountyState}"
6.
OpenDropDownOnFocus
=
"True"
7.
IsFilteringEnabled
=
"True"
8.
ItemTemplate
=
"{StaticResource ComboBoxCustomTemplate}"
/>
01.
public class AddEditViewModel : ViewModelBase<
IDialogView
>, IDisposable
02.
{
03.
private readonly GeotechLogContext context;
04.
05.
public ObservableCollection<
CityCountyState
> CitiesCountiesStates { get; set; }
06.
private string _SelectedCityCountyState;
07.
public string SelectedCityCountyState
08.
{
09.
get
10.
{
11.
return this._SelectedCityCountyState;
12.
}
13.
set
14.
{
15.
// This doesn't work, but it's what I want to do in concept.
16.
// Value is always a string that equals the object type
17.
//
18.
// CityCountyState x = (CityCountyState) value;
19.
// this._SelectedCityCountyState = x.City + "," + x.County + "," + x.State;
20.
this._SelectedCityCountyState = value;
21.
}
22.
}
23.
24.
public AddEditViewModel : base( new AddEditWindow() )
25.
{
26.
this.context = new GeotechLogContext();
27.
this.CitiesCountiesStates = new ObservableCollection<
CityCountyState
>
28.
(this.context.CityCountyStates.ToList<
CityCountyState
>() );
29.
}
30.
}