ViewBox Support

4 posts, 1 answers
  1. Tim
    Tim avatar
    114 posts
    Member since:
    Aug 2011

    Posted 06 Sep 2011 Link to this post

    Hello.

    I need a TileView in a ViewBox. How to work around the error "InvalidOperationException: UIEllement.Arrange(finalRect) cannot be called with Infinite or NaN values in finallRect." Do I have to set the width and height? Are there other workarounds?

    Thanks a lot in advance,
    Tim.
  2. Tim
    Tim avatar
    114 posts
    Member since:
    Aug 2011

    Posted 06 Sep 2011 Link to this post

    Forgot my RadTileView definition:

    <telerik:RadTileView x:Name="myTileView"
                         ColumnsCount="4"
                         ColumnWidth="Auto"
                         ItemsSource="{Binding Items}"
                         RowHeight="Auto"
                         MinimizedColumnWidth="250"
                         MinimizedRowHeight="150"
                         PreservePositionWhenMaximized="True"
                         IsItemsSizeInPercentages="True"
                         telerik:TileViewPanel.IsSizeBoundToPosition="True"
                         telerik:TileViewPanel.IsRowsShrinkEnabled="True"
                         telerik:TileViewPanel.IsColumnsShrinkEnabled="True">
        <telerik:RadTileView.ItemTemplate>
            <DataTemplate telerik:ContainerBinding.ContainerBindings="{StaticResource bindings}">
                <TextBlock Text="{Binding Header}" />
            </DataTemplate>
        </telerik:RadTileView.ItemTemplate>
        <telerik:RadTileView.ContentTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Content}" />
            </DataTemplate>
        </telerik:RadTileView.ContentTemplate>
    </telerik:RadTileView>



  3. DevCraft banner
  4. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 06 Sep 2011 Link to this post

    Hello Tim,
    Thank you for the feedback. The problem in your case is that you're setting the IsItemsSizeInPercentages property to True which means that the width/height of an item will be (lets say) 20% from the available width/height but when the RadTileView is inside a ViewBox the available width/height is infinity and 20% from infinity is infinity.
    You can do two things in this case:
    - You can set the IsItemsSizeInPercentages to false and use static sizes.
    - You can keep the IsItemsSizeInPercentages set to true but you'll have to set Height/MaxHeight and Width/MaxWidth to the RadTileView.
    I've attached a sample project using the second approach so could you please examine it and if you have further questions feel free to ask.

    Regards,
    Zarko
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  5. Tim
    Tim avatar
    114 posts
    Member since:
    Aug 2011

    Posted 06 Sep 2011 Link to this post

    Hi Zarko,

    thanks a lot for your fast reply, your explanations and your sample project!  I am now setting the Width and Height...
    All the best,
    Tim.
Back to Top