Controle las sugerencias que funcionan como un listBox de varias columnas

I've looked at a bunch of different controls(ListView, GridView, etc.) and can't decide which makes the most sense for me to use.

I want something that looks and functions just like a listBox with the ability to select a row with a single click, except it would contain data with multiple columns.

I'm just looking for suggestions on which control to use and how I would go about having it select a row(whether it's a selectionMode or an onClick function or what). Since I'm new to these controls I'd like some direction on which tag to place those selection options, I think I can figure out the rest however.

Gracias :)

preguntado el 01 de febrero de 12 a las 22:02

1 Respuestas

I like using the ListView that contains a GridView as it's view. Here's how I defined it in XAML:

<ListView Name="lstCurrentInvoices" Grid.Row="4" Margin="0,0,0,0" SelectionMode="Extended" ToolTip="Invoices included in invoice file." IsTabStop="True" TabIndex="8">
  <ListView.View>
    <GridView>
      <GridViewColumn Width="40" Header="ID" DisplayMemberBinding="{Binding ClientId}"/>
      <GridViewColumn Width="170" Header="Name" DisplayMemberBinding="{Binding ClientName}"/>
      <GridViewColumn Width="80" Header="Date" DisplayMemberBinding="{Binding InvoiceDate}"/>
      <GridViewColumn Width="40" Header="Frequency" DisplayMemberBinding="{Binding Frequency}" />
    </GridView>
  </ListView.View>
</ListView>

This way you kind of get the best of both worlds. In this example, you can have multiple rows selected. You can detect which rows have been selected and grab the objects from you data source. It's really quite powerful. Hope this helps

Respondido 02 Feb 12, 03:02

That looks nice and simple, I'm not using XAML but I might be able to convert that fairly easily. Thanks :) - mrfreester

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.