Suggestion.
There is a small caveat when using UI Virtualization with RadTileView in the following way:
When you use a DateTemplate that consists of a implementation of some sort of ContentControl that binds its ContentProperty to a view inside your DataContext, that view needs to be served fresh on every {get;} or you will get the following exception when the Tiles are "virtualized" into existence for the second time:
There is a small caveat when using UI Virtualization with RadTileView in the following way:
<
UserControl.Resources
>
<!-- RadTileView Styles-->
<
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
=
"ColumnsCount"
Value
=
"3"
/>
<
Setter
Property
=
"RowsCount"
Value
=
"3"
/>
</
Style
>
<
Style
TargetType
=
"telerik:RadTileViewItem"
>
<
Setter
Property
=
"Background"
Value
=
"#06749b"
/>
</
Style
>
<!-- RadTileView Templates-->
<
DataTemplate
x:Key
=
"headerTemplate"
>
<!-- This usage does not cause strange exceptions-->
<
TextBlock
Text
=
"{Binding Heading}"
/>
</
DataTemplate
>
<
DataTemplate
x:Key
=
"contentTemplate"
>
<
telerik:RadFluidContentControl
TransitionDuration
=
"0:0:.5"
Padding
=
"5,5,5,5"
HorizontalContentAlignment
=
"Stretch"
VerticalContentAlignment
=
"Stretch"
>
<
telerik:RadFluidContentControl.SmallContent
>
<!-- Does cause Arg_TargetInvocationException exceptions if the bound view has bindings-->
<
ContentControl
Content
=
"{Binding SmallContent}"
VerticalContentAlignment
=
"Stretch"
HorizontalContentAlignment
=
"Stretch"
/>
</
telerik:RadFluidContentControl.SmallContent
>
<
telerik:RadFluidContentControl.Content
>
<
ContentControl
Content
=
"{Binding Content}"
VerticalContentAlignment
=
"Stretch"
HorizontalContentAlignment
=
"Stretch"
/>
</
telerik:RadFluidContentControl.Content
>
<
telerik:RadFluidContentControl.LargeContent
>
<
ContentControl
Content
=
"{Binding LargeContent}"
VerticalContentAlignment
=
"Stretch"
HorizontalContentAlignment
=
"Stretch"
/>
</
telerik:RadFluidContentControl.LargeContent
>
</
telerik:RadFluidContentControl
>
</
DataTemplate
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"{x:Null}"
SizeChanged
=
"LayoutRoot_SizeChanged"
>
<
telerik:RadTileView
x:Name
=
"TileView"
ItemTemplate
=
"{StaticResource headerTemplate}"
ContentTemplate
=
"{StaticResource contentTemplate}"
ItemsSource
=
"{Binding Reports}"
/>
</
Grid
>
When you use a DateTemplate that consists of a implementation of some sort of ContentControl that binds its ContentProperty to a view inside your DataContext, that view needs to be served fresh on every {get;} or you will get the following exception when the Tiles are "virtualized" into existence for the second time:
System.Reflection.TargetInvocationException was unhandled by user code
Message=[Arg_TargetInvocationException]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.60401.00&File=mscorlib.dll&Key=Arg_TargetInvocationException
StackTrace:
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at DashboardViewxaml_3.BindingOperation(Object BindingState, Int32 , Action )
InnerException: System.ArgumentException
Message=[Arg_ArgumentException]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.60401.00&File=mscorlib.dll&Key=Arg_ArgumentException
StackTrace:
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)
at System.Windows.Data.BindingExpression.SendDataToTarget()
at System.Windows.Data.BindingExpression.SourceAcquired()
at System.Windows.Data.Debugging.BindingBreakPoint.<>c__DisplayClass4.<
BreakOnSharedType
>b__3()
InnerException:
Maybe add this to your documentation and save another developer some serious downtime.