• <legend id='0U5Az'><style id='0U5Az'><dir id='0U5Az'><q id='0U5Az'></q></dir></style></legend>
    • <bdo id='0U5Az'></bdo><ul id='0U5Az'></ul>
  • <small id='0U5Az'></small><noframes id='0U5Az'>

      1. <i id='0U5Az'><tr id='0U5Az'><dt id='0U5Az'><q id='0U5Az'><span id='0U5Az'><b id='0U5Az'><form id='0U5Az'><ins id='0U5Az'></ins><ul id='0U5Az'></ul><sub id='0U5Az'></sub></form><legend id='0U5Az'></legend><bdo id='0U5Az'><pre id='0U5Az'><center id='0U5Az'></center></pre></bdo></b><th id='0U5Az'></th></span></q></dt></tr></i><div id='0U5Az'><tfoot id='0U5Az'></tfoot><dl id='0U5Az'><fieldset id='0U5Az'></fieldset></dl></div>
        <tfoot id='0U5Az'></tfoot>

        wpf Listbox给列一个标题

        时间:2023-10-07
      2. <i id='KP5aU'><tr id='KP5aU'><dt id='KP5aU'><q id='KP5aU'><span id='KP5aU'><b id='KP5aU'><form id='KP5aU'><ins id='KP5aU'></ins><ul id='KP5aU'></ul><sub id='KP5aU'></sub></form><legend id='KP5aU'></legend><bdo id='KP5aU'><pre id='KP5aU'><center id='KP5aU'></center></pre></bdo></b><th id='KP5aU'></th></span></q></dt></tr></i><div id='KP5aU'><tfoot id='KP5aU'></tfoot><dl id='KP5aU'><fieldset id='KP5aU'></fieldset></dl></div>

        <small id='KP5aU'></small><noframes id='KP5aU'>

          1. <tfoot id='KP5aU'></tfoot>
              <tbody id='KP5aU'></tbody>

              <bdo id='KP5aU'></bdo><ul id='KP5aU'></ul>
              <legend id='KP5aU'><style id='KP5aU'><dir id='KP5aU'><q id='KP5aU'></q></dir></style></legend>

                  本文介绍了wpf Listbox给列一个标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有以下标记 (xaml):

                  I have the following markup (xaml):

                  <ListBox Name="lbEurInsuredType" HorizontalContentAlignment="Stretch">
                              <ListBox.ItemTemplate>
                                 <DataTemplate>
                                      <Grid Margin="0,2">
                                          <Grid.ColumnDefinitions>
                                          <ColumnDefinition Width="100"></ColumnDefinition>
                                              <ColumnDefinition Width="30"></ColumnDefinition><ColumnDefinition Width="2"></ColumnDefinition>
                                              <ColumnDefinition Width="30"></ColumnDefinition>
                                     </Grid.ColumnDefinitions>
                                     <TextBlock Text="{Binding Title}"></TextBlock>
                                     <TextBox Text="{Binding Uw}" Grid.Column="1"></TextBox>
                                     <TextBox Text="{Binding Partner}" Grid.Column="3"></TextBox>
                                  </Grid>
                              </DataTemplate></ListBox.ItemTemplate>
                  
                          </ListBox>
                  

                  这一切看起来都不错,但现在我想在第 1 列和第 3 列上方放置一个标题.谁能告诉我如何在我的两列中添加标题.

                  This all looks ok, but now above column 1 and 3 I want to place a header. Can anyone show me how I add headers to my two columns.

                  推荐答案

                  Listview 肯定是最好的选择,但是如果你需要使用列表框,你可以通过这种方式修改列表框的模板.

                  Listview is surely the best option, but, if you need to use a listbox you could modify the template of the listbox in this way.

                     <ListBox Name="lbEurInsuredType" HorizontalContentAlignment="Stretch">
                          <ListBox.Template>
                              <ControlTemplate>
                                  <DockPanel LastChildFill="True">
                                      <Grid DockPanel.Dock="Top" Height="30">
                                          <Grid.ColumnDefinitions>
                                              <ColumnDefinition Width="100"></ColumnDefinition>
                                              <ColumnDefinition Width="30"></ColumnDefinition>
                                              <ColumnDefinition Width="2"></ColumnDefinition>
                                              <ColumnDefinition Width="30"></ColumnDefinition>
                                          </Grid.ColumnDefinitions>
                                          <Label Grid.Column="0">Column 1</Label>
                                          <Label Grid.Column="1">Column 2</Label>
                                          <Label Grid.Column="2">Column 3</Label>
                                          <Label Grid.Column="3">Column 4</Label>
                                      </Grid>
                                      <ItemsPresenter></ItemsPresenter>
                                  </DockPanel>
                              </ControlTemplate>
                          </ListBox.Template>
                          <ListBox.ItemTemplate>
                              <DataTemplate>
                                  <Grid Margin="0,2">
                                      <Grid.ColumnDefinitions>
                                          <ColumnDefinition Width="100"></ColumnDefinition>
                                          <ColumnDefinition Width="30"></ColumnDefinition>
                                          <ColumnDefinition Width="2"></ColumnDefinition>
                                          <ColumnDefinition Width="30"></ColumnDefinition>
                                      </Grid.ColumnDefinitions>
                                      <TextBlock Text="{Binding Title}"></TextBlock>
                                      <TextBox Text="{Binding Uw}" Grid.Column="1"></TextBox>
                                      <TextBox Text="{Binding Partner}" Grid.Column="3"></TextBox>
                                  </Grid>
                              </DataTemplate>
                          </ListBox.ItemTemplate>
                      </ListBox>
                  

                  这篇关于wpf Listbox给列一个标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Windows.Forms.ListBox 与 OwnerDrawVariable 错误? 下一篇:C# - 无法在 WinForms 的列表框中执行键值操作

                  相关文章

                1. <legend id='QVqfi'><style id='QVqfi'><dir id='QVqfi'><q id='QVqfi'></q></dir></style></legend>

                      <tfoot id='QVqfi'></tfoot>

                        <bdo id='QVqfi'></bdo><ul id='QVqfi'></ul>
                    1. <small id='QVqfi'></small><noframes id='QVqfi'>

                    2. <i id='QVqfi'><tr id='QVqfi'><dt id='QVqfi'><q id='QVqfi'><span id='QVqfi'><b id='QVqfi'><form id='QVqfi'><ins id='QVqfi'></ins><ul id='QVqfi'></ul><sub id='QVqfi'></sub></form><legend id='QVqfi'></legend><bdo id='QVqfi'><pre id='QVqfi'><center id='QVqfi'></center></pre></bdo></b><th id='QVqfi'></th></span></q></dt></tr></i><div id='QVqfi'><tfoot id='QVqfi'></tfoot><dl id='QVqfi'><fieldset id='QVqfi'></fieldset></dl></div>