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

How to center RadLoopingList - HorizontalAlignment?

1 Answer 61 Views
LoopingList
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
AS
Top achievements
Rank 1
AS asked on 30 May 2015, 11:24 PM

Hi

I am struggling with what I know is a simple thing ... any advice is appreciated.

I am trying to center the RadLoopingList in a grid, not the content in the list, but the full list itself.

In a blank page, I have the following ... (using sample code from http://docs.telerik.com/windows-universal/controls/radloopinglist/loopinglist-getting-started

)

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <telerikLoopingList:RadLoopingList x:Name="loopingList"/>
</Grid>

 populated as ....

loopingList.ItemsSource = Enumerable.Range(0,10).ToList();

 

By default, the RadLoopingList is rendered left aligned to the grid ... How can I center it? HorizontalAlignment seems not to work.

 

I have resorted to centering it with the Grid ...

 

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
 
        <Grid.ColumnDefinitions>
 
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="*"/>
 
        </Grid.ColumnDefinitions>
         
        <telerikLoopingList:RadLoopingList x:Name="loopingList" Grid.Column="1"/>
    </Grid>

 

 Any pointers appreciated!

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavel R. Pavlov
Telerik team
answered on 03 Jun 2015, 08:22 AM
Hi,

HorizontalAlignment is the property that you need in your case. It does not seems to work for you because the RadLoopingList is stretched all over the Grid and there is no way for it to be centered. In addition to the HorizontalAlignment property you can try setting a fixed size of the RadLoopingList itself. For example you can limit it to 90 pixels. Doing this will allow the HorizontalAlignment="Center" to take action.

Please give this approach a try and let us know if you need any further assistance.

Regards,
Pavel R. Pavlov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
LoopingList
Asked by
AS
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or