Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda