Hi, I am working on an application based on RadTileView, similar to the 'Example' that Telerik provides in
http://www.telerik.com/help/wpf/radtileview-howto-use-fluidcontentcontrol-in-tileview.html
My problem is that raises an exception when TileState property has to be bound through 'tileStateConverter'. If I change the value to Maximized, Minimized o Restored does not crash. The exception is a XamlParseException: A error raises when setting the property ''. (More or less cause the text is displayed to me in Spanish).
Here is the xaml file:
And here the converter for TileState property:
I do know what is happening because for FluidContentStateConverter and its conversion seems is fine..
Thank so much (in advance).
Eduardo
http://www.telerik.com/help/wpf/radtileview-howto-use-fluidcontentcontrol-in-tileview.html
My problem is that raises an exception when TileState property has to be bound through 'tileStateConverter'. If I change the value to Maximized, Minimized o Restored does not crash. The exception is a XamlParseException: A error raises when setting the property ''. (More or less cause the text is displayed to me in Spanish).
Here is the xaml file:
<
UserControl.Resources
>
<
local:FluidContentStateConverter
x:Key
=
"fluidContentStateConverter"
/>
<
local:TileStateConverter
x:Key
=
"tileStateConverter"
/>
<!--HeaderedContentControl Resources-->
<
SolidColorBrush
x:Key
=
"Pad_BorderBrush"
Color
=
"#FF242699"
/>
<
SolidColorBrush
x:Key
=
"Pad_Background"
Color
=
"#FFFFFF"
/>
<
SolidColorBrush
x:Key
=
"Pad_Header_Background"
Color
=
"#FF242699"
/>
<
Style
x:Key
=
"DefaultHeaderedContentControlStyle"
TargetType
=
"telerik:HeaderedContentControl"
>
<
Setter
Property
=
"BorderThickness"
Value
=
"1 0 1 1"
/>
<
Setter
Property
=
"BorderBrush"
Value
=
"{StaticResource Pad_BorderBrush}"
/>
<
Setter
Property
=
"Background"
Value
=
"{StaticResource Pad_Background}"
/>
<
Setter
Property
=
"Foreground"
Value
=
"White"
/>
<
Setter
Property
=
"FontWeight"
Value
=
"Bold"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:HeaderedContentControl"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
Border
Background
=
"{StaticResource Pad_Header_Background}"
CornerRadius
=
"4 4 0 0"
Padding
=
"10 7"
Grid.Row
=
"0"
>
<
ContentPresenter
ContentTemplate
=
"{TemplateBinding HeaderTemplate}"
Content
=
"{TemplateBinding Header}"
/>
</
Border
>
<
Border
BorderBrush
=
"{TemplateBinding BorderBrush}"
BorderThickness
=
"{TemplateBinding BorderThickness}"
Background
=
"{TemplateBinding Background}"
CornerRadius
=
"0 0 4 4"
Grid.Row
=
"1"
>
<
ContentPresenter
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
Margin
=
"{TemplateBinding Padding}"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
/>
</
Border
>
</
Grid
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
<
DataTemplate
x:Key
=
"ItemTemplate"
>
<
TextBox
Text
=
"{Binding Login}"
/>
</
DataTemplate
>
<!-- RadTileView -->
<
DataTemplate
x:Key
=
"ContentTemplate"
>
<
telerik:RadFluidContentControl
ContentChangeMode
=
"Manual"
State
=
"{Binding ContentState, Converter={StaticResource fluidContentStateConverter}}"
>
<
telerik:RadFluidContentControl.SmallContent
>
<
TextBlock
Text
=
"Peque"
></
TextBlock
>
</
telerik:RadFluidContentControl.SmallContent
>
<
telerik:RadFluidContentControl.Content
>
<
TextBlock
Text
=
"Normal"
></
TextBlock
>
</
telerik:RadFluidContentControl.Content
>
<
telerik:RadFluidContentControl.LargeContent
>
<
TextBlock
Text
=
"Big"
></
TextBlock
>
</
telerik:RadFluidContentControl.LargeContent
>
</
telerik:RadFluidContentControl
>
</
DataTemplate
>
<
Style
x:Key
=
"ItemContainerStyle"
TargetType
=
"telerik:RadTileViewItem"
>
<
Setter
Property
=
"TileState"
Value
=
"{Binding ContentState, Mode=TwoWay, Converter={StaticResource tileStateConverter}}"
/>
</
Style
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"{StaticResource FondoMalva}"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"150"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
telerik:HeaderedContentControl
Height
=
"300"
HorizontalAlignment
=
"Center"
Width
=
"Auto"
VerticalAlignment
=
"Center"
Name
=
"HeaderedControlUsers"
Style
=
"{StaticResource DefaultHeaderedContentControlStyle}"
Header
=
"Users"
>
<
telerik:RadTileView
Name
=
"RadTileViewUsers"
ContentTemplate
=
"{StaticResource ContentTemplate}"
ItemContainerStyle
=
"{StaticResource ItemContainerStyle}"
ItemTemplate
=
"{StaticResource ItemTemplate}"
MinimizedColumnWidth
=
"200"
MinimizedItemsPosition
=
"Right"
MinimizedRowHeight
=
"200"
/>
</
telerik:HeaderedContentControl
>
And here the converter for TileState property:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Windows.Data;
using
Telerik.Windows.Controls;
namespace
NCOP_Mgt
{
public
class
TileStateConverter : IValueConverter
{
public
object
Convert(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
var contentState = (ContentState)value;
switch
(contentState)
{
case
ContentState.SmallContent:
return
TileViewItemState.Minimized;
case
ContentState.NormalContent:
return
TileViewItemState.Restored;
case
ContentState.LargeContent:
return
TileViewItemState.Maximized;
default
:
return
TileViewItemState.Restored;
}
}
public
object
ConvertBack(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
var tileState = (TileViewItemState)value;
switch
(tileState)
{
case
TileViewItemState.Minimized:
return
ContentState.SmallContent;
case
TileViewItemState.Restored:
return
ContentState.NormalContent;
case
TileViewItemState.Maximized:
return
ContentState.LargeContent;
default
:
return
ContentState.NormalContent;
}
}
}
}
I do know what is happening because for FluidContentStateConverter and its conversion seems is fine..
Thank so much (in advance).
Eduardo