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

[Solved] SlideHubTile alignment for different resolutions

2 Answers 52 Views
HubTile for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alper Cem
Top achievements
Rank 1
Alper Cem asked on 28 Jul 2014, 08:55 PM
Hello,

I am developing a Windows Phone 8.0 app and would like to develop a page as similar to the image I attached. In short, there will be different sizes of HubTiles in a page, and I use Grid definitions to split the page into rows and columns so that the page can fit well to different screen resolutions. The problem is SlideHubTile doesn't support "Auto" sizing for Horizontal & Vertical Alignment, it requires to manually set a width & height and it gives "value doesn't fall within the rage" exception otherwise. And I need to do so in order to fit them to the rows and columns automatically. 

As a workaround, I try to get the screen size of the phone and set the width & height of the tiles in the code-behind. It worked in terms of appearance, but the image and the text started to behave weird.

Waiting for solutions or suggestions.

Thanks,
Alper

2 Answers, 1 is accepted

Sort by
0
Alper Cem
Top achievements
Rank 1
answered on 28 Jul 2014, 08:56 PM
The image on the right is what I meant.
0
Rosy Topchiyska
Telerik team
answered on 31 Jul 2014, 02:06 PM
Hello,

Thank you for contacting us.

The HubTile has fixes size by default. You have to set its Width and Height to double.NaN to force the control to invalidate its measurement state and take the space provided by its parent. You can use the Loaded event to do this.

<Grid Margin="20">
    <Grid.RowDefinitions>
        <RowDefinition Height="2*"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="2*"/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <telerik:RadHubTile Loaded="RadHubTile_Loaded" Grid.Row="0" Grid.Column="0"/>
    <telerik:RadHubTile Loaded="RadHubTile_Loaded" Grid.Row="0" Grid.Column="1"/>
    <telerik:RadHubTile Loaded="RadHubTile_Loaded" Grid.Row="1" Grid.Column="0"/>
    <telerik:RadHubTile Loaded="RadHubTile_Loaded" Grid.Row="1" Grid.Column="1"/>
</Grid>

private void RadHubTile_Loaded(object sender, RoutedEventArgs e)
{
    var tile = sender as RadHubTile;
    tile.Width = double.NaN;
    tile.Height = double.NaN;
}

I hope this helps. Please, let us know if you gave further questions.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
HubTile for XAML
Asked by
Alper Cem
Top achievements
Rank 1
Answers by
Alper Cem
Top achievements
Rank 1
Rosy Topchiyska
Telerik team
Share this question
or