Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
Bind elements to 2 different columns in a Z way

I have a mainview with a grid divided into two columns.

The issue is that I have an organized list of view models ( user controls with a textbox with different scopes ) that is created dynamically, and I want to display them in a Z way. I.e: from left to right, top to bottom ( see image )

enter image description here

At the moment i'm using something like the code above, dividing the list in the viewmodel into two different lists according to the element index.

<Grid>
<Grid.ColumnDefinitions>
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<Stackpanel Grid.Column=0>
  <ItemsControl.ItemTemplate>
    <DataTemplate DataType="EvenElements">
        <Border>
            <TextBlock Text="{Binding}" />
        </Border>
    </DataTemplate>
  </ItemsControl.ItemTemplate>
</Stackpanel> 

<Stackpanel Grid.Column=1>
  <ItemsControl.ItemTemplate>
    <DataTemplate DataType="OddElements">
        <Border>
            <TextBlock Text="{Binding}" />
        </Border>
    </DataTemplate>
  </ItemsControl.ItemTemplate>
</Stackpanel> 
</Grid>

Is there a way to do it in a single binding style? I don't want to join the textboxes input later because the index matters, and the code doesn't look that clean in that way. Thank you

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

If I understand your issue correctly, you could use an UniformGrid as the ItemsPanel of the ItemsControl:

<ItemsControl>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <UniformGrid Columns="2" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
</ItemsControl>
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda