ck_russ
Topic Author
Posts: 27
Joined: 20 May 2020, 14:41

Unable to set Row/Column of items within an ItemsControl with an ItemsTemplatePanel Grid style

20 Jul 2020, 09:13

As per topic, here is a XAMLToy ready example:
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  <ItemsControl>
    <ItemsControl.ItemsPanel>
      <ItemsPanelTemplate>
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
          </Grid.ColumnDefinitions>
        </Grid>
      </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <Rectangle Grid.Row="1" Grid.Column="1" Fill="Green"/>
  </ItemsControl>
</Grid>

The square ends up at [0,0] and instead [1,1].

This issue only seems to happen when adding individual items to an ItemsControl. Setting the Grid's Row/Column works fine when using an ItemsSource+ItemsTemplate.
 
User avatar
sfernandez
Site Admin
Posts: 1920
Joined: 22 Dec 2011, 19:20

Re: Unable to set Row/Column of items within an ItemsControl with an ItemsTemplatePanel Grid style

20 Jul 2020, 16:52

Hi, this is a bug, Noesis is wrapping ItemsControl items with a ContentPresenter as container, even when items already are a UIElement. In WPF when items are UIElement they are directly the item and container in the items control. This is why Grid.Row/Column is not working in Noesis but it works in WPF.

We'll fix it for next release.
 
ck_russ
Topic Author
Posts: 27
Joined: 20 May 2020, 14:41

Re: Unable to set Row/Column of items within an ItemsControl with an ItemsTemplatePanel Grid style

20 Jul 2020, 18:57

Makes sense. Thanks.

Who is online

Users browsing this forum: Google [Bot] and 1 guest