在ItemsControl中具有自适应高度的wpf UserControl

时间:2019-01-18 14:37:36

标签: c# .net wpf xaml

我正在搜索如何显示我的所有商品,但是为此,我需要自动对我的用户控件进行称重 我希望与:一样的距离

  <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="*"/>
        <RowDefinition Height="*"/>
        .
        .
        .
        <RowDefinition Height="*"/>
        <RowDefinition Height="*"/>
        <RowDefinition Height="*"/>
     </Grid.RowDefinitions >
     <control:Plat Grid.Row="1"></control:Plat>
     <control:Plat Grid.Row="2"></control:Plat>
     <control:Plat Grid.Row="3"></control:Plat>
     .
     .
     .
     <control:Plat Grid.Row="n-2"></control:Plat>
     <control:Plat Grid.Row="n-1"></control:Plat>
     <control:Plat Grid.Row="n"></control:Plat>
  </Grid>

使用此代码:

<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
    <ColumnDefinition />
    <ColumnDefinition />
    <ColumnDefinition />
</Grid.ColumnDefinitions>

<DockPanel>
    <ItemsControl x:Name="RepasMatin">
        <ItemsControl.ItemTemplate>
            <DataTemplate DataType="classes:C_T_plat">
                <control:Plat ></control:Plat>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</DockPanel>
<materialDesign:PackIcon Kind="Build" Grid.Column="2" HorizontalAlignment="Right" Cursor="Hand"/>

最好的问候

0 个答案:

没有答案