1

I want to display a list's items clockwise in a rectangular grid; the list has constant size. I'm trying the below but the text of all items seems to overlap in the grid's first row and column. What am I doing wrong?

    <ItemsControl 
        ItemsSource="{Binding Squares}"
        DisplayMemberPath="Value"
        >
        <ItemsControl.ItemContainerStyle>
            <Style TargetType="ContentPresenter">
                <Setter Property="Grid.Row" Value="{Binding Row}"/>
                <Setter Property="Grid.Column" Value="{Binding Column}"/>
            </Style>
        </ItemsControl.ItemContainerStyle>
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                </Grid>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ItemsControl>
Craig
  • 1,890
  • 1
  • 26
  • 44

1 Answers1

1

Setters don't support binding in UWP (see docs here).

But there's a workaround posted here.

Michael Hawker - MSFT
  • 1,572
  • 12
  • 18