or
<
Window
x:Class
=
"MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"625"
Width
=
"1300"
WindowState
=
"Maximized"
>
<
Grid
>
<
Grid.Resources
>
<
Style
TargetType
=
"TextBlock"
x:Key
=
"TileLabelStyle"
>
<
Setter
Property
=
"FontSize"
Value
=
"14"
/>
<
Setter
Property
=
"FontFamily"
Value
=
"Segoe UI"
/>
<
Setter
Property
=
"Margin"
Value
=
"0"
/>
<
Setter
Property
=
"VerticalAlignment"
Value
=
"Top"
/>
</
Style
>
</
Grid.Resources
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"35"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
Button
Content
=
"All Small"
Grid.Row
=
"0"
Click
=
"Button_Click"
HorizontalAlignment
=
"Left"
Width
=
"96"
/>
<
Button
Content
=
"All Double"
Grid.Row
=
"0"
Margin
=
"101,0,0,0"
Click
=
"Button_Click_1"
HorizontalAlignment
=
"Left"
Width
=
"96"
/>
<
Button
Content
=
"All Quadruple"
Grid.Row
=
"0"
Margin
=
"202,0,0,0"
Click
=
"Button_Click_2"
HorizontalAlignment
=
"Left"
Width
=
"96"
/>
<
telerik:RadTileList
IsManipulationEnabled
=
"True"
TilePlaceHolderSide
=
"150"
ScrollViewer.HorizontalScrollBarVisibility
=
"Visible"
CanUserSelect
=
"False"
x:Name
=
"MainTileList"
Grid.Row
=
"1"
>
<
telerik:Tile
TileType
=
"Single"
Background
=
"Bisque"
>
<
Grid
>
<
TextBlock
Text
=
"Single"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Single"
>
<
Grid
>
<
TextBlock
Text
=
"Single"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Single"
>
<
Grid
>
<
TextBlock
Text
=
"Single"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Double"
Background
=
"DarkRed"
>
<
Grid
>
<
TextBlock
Text
=
"Double"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Double"
>
<
Grid
>
<
TextBlock
Text
=
"Double"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Quadruple"
>
<
Grid
>
<
TextBlock
Text
=
"Quadruple"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Double"
Background
=
"Coral"
>
<
Grid
>
<
TextBlock
Text
=
"Double"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Double"
>
<
Grid
>
<
TextBlock
Text
=
"Double"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Single"
>
<
Grid
>
<
TextBlock
Text
=
"Single"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Double"
Background
=
"DeepPink"
>
<
Grid
>
<
TextBlock
Text
=
"Double"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Double"
>
<
Grid
>
<
TextBlock
Text
=
"Double"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Single"
Background
=
"DarkViolet"
>
<
Grid
>
<
TextBlock
Text
=
"Single"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Quadruple"
Background
=
"Green"
>
<
Grid
>
<
TextBlock
Text
=
"Quadruple"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Single"
Background
=
"DarkSalmon"
>
<
Grid
>
<
TextBlock
Text
=
"Single"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
<
telerik:Tile
TileType
=
"Quadruple"
Background
=
"MidnightBlue"
>
<
Grid
>
<
TextBlock
Text
=
"Quadruple"
Style
=
"{StaticResource TileLabelStyle}"
/>
</
Grid
>
</
telerik:Tile
>
</
telerik:RadTileList
>
</
Grid
>
</
Window
>
Imports
Telerik.Windows.Controls
Class
MainWindow
Private
Sub
MainWindow_Loaded(sender
As
Object
, e
As
RoutedEventArgs)
Handles
Me
.Loaded
Dim
MainContextMenu
As
New
ContextMenu
Dim
smallMenuItem
As
New
MenuItem
With
{.Header =
"Small"
}
Dim
wideMenuItem
As
New
MenuItem
With
{.Header =
"Wide"
}
Dim
largeMenuItem
As
New
MenuItem
With
{.Header =
"Large"
}
MainContextMenu.Items.Add(smallMenuItem)
MainContextMenu.Items.Add(wideMenuItem)
MainContextMenu.Items.Add(largeMenuItem)
AddHandler
smallMenuItem.Click,
AddressOf
SmallSizeClick
AddHandler
wideMenuItem.Click,
AddressOf
WideSizeClick
AddHandler
largeMenuItem.Click,
AddressOf
LargeSizeClick
For
Each
c
As
Tile
In
MainTileList.Items
c.ContextMenu = MainContextMenu
Next
End
Sub
Private
Sub
SmallSizeClick(sender
As
Object
, e
As
RoutedEventArgs)
Dim
tile =
DirectCast
(
DirectCast
(
DirectCast
(sender, MenuItem).Parent, ContextMenu).PlacementTarget, Tile)
tile.TileType = TileType.
Single
End
Sub
Private
Sub
WideSizeClick(sender
As
Object
, e
As
RoutedEventArgs)
Dim
tile =
DirectCast
(
DirectCast
(
DirectCast
(sender, MenuItem).Parent, ContextMenu).PlacementTarget, Tile)
tile.TileType = TileType.
Double
End
Sub
Private
Sub
LargeSizeClick(sender
As
Object
, e
As
RoutedEventArgs)
Dim
tile =
DirectCast
(
DirectCast
(
DirectCast
(sender, MenuItem).Parent, ContextMenu).PlacementTarget, Tile)
tile.TileType = TileType.Quadruple
End
Sub
Private
Sub
Button_Click(sender
As
Object
, e
As
RoutedEventArgs)
For
Each
t
As
Tile
In
MainTileList.Items
t.TileType = TileType.
Single
Next
End
Sub
Private
Sub
Button_Click_1(sender
As
Object
, e
As
RoutedEventArgs)
For
Each
t
As
Tile
In
MainTileList.Items
t.TileType = TileType.
Double
Next
End
Sub
Private
Sub
Button_Click_2(sender
As
Object
, e
As
RoutedEventArgs)
For
Each
t
As
Tile
In
MainTileList.Items
t.TileType = TileType.Quadruple
Next
End
Sub
End
Class
public
string
this
[Guid column]
{
get
{ ....}
set
{ ... }
}
GridViewDataColumn col =
new
GridViewDataColumn();<br>
col.Header = c.Column.Name;<br>
col.DataMemberBinding =
new
Binding(String.Format(
"[{0}]"
, c.Column.Id)) { FallbackValue =
null
};
col.ColumnGroupName = g.Header;
this
.Columns.Add(col);
// App.xaml
<
Application
x:Class
=
"SampleAppWithRadGridView.App"
StartupUri
=
"MainWindow.xaml"
DispatcherUnhandledException
=
"Application_DispatcherUnhandledException"
/>
// App.xaml.cs
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
MessageBox.Show(e.Exception.Message);
}
// MainWindow.xaml
<
telerik:RadGridView
Name
=
"gridView"
IsReadOnly
=
"False"
EditTriggers
=
"F2"
Width
=
"200"
></
telerik:RadGridView
>
// MainWindow.xaml.cs
public partial class MainWindow : Window
{
IList<
Student
> studentList = new List<
Student
>();
public MainWindow()
{
InitializeComponent();
InitializeStudentList();
LoadGrid();
}
void InitializeStudentList()
{
studentList.Add(new Student { FirstName = "Robert", LastName = "Williams" });
studentList.Add(new Student { FirstName = "Eric", LastName = "James" });
studentList.Add(new Student { FirstName = "Randy", LastName = "Spencer" });
gridView.ItemsSource = studentList;
}
void LoadGrid()
{
gridView.CellValidating += HandleCellValidating;
}
void HandleCellValidating(object sender, GridViewCellValidatingEventArgs e)
{
if (studentList.Any(s => s.FirstName == e.NewValue.ToString()))
{
e.Handled = true;
throw new Exception();
}
}
}