This is a migrated thread and some comments may be shown as answers.

UI Virtualization in non trivial Implementations

1 Answer 75 Views
TileView
This is a migrated thread and some comments may be shown as answers.
pompomJuice
Top achievements
Rank 1
pompomJuice asked on 04 Jul 2011, 08:44 PM
Suggestion.

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.

1 Answer, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 07 Jul 2011, 08:54 AM
Hi Pompomjuice,
Thank you for the suggestion. We are aware of this issue and we'll try to fix it as soon as possible and you can track its status here.
If you have more questions feel free to ask.

Regards,
Zarko
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
TileView
Asked by
pompomJuice
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Share this question
or