<ListBox x:Name="myData" ItemsSource="{Binding Data}" Background="{StaticResource TransparentColor}" Grid.Row="1"
BorderBrush="{StaticResource LeftGridColor}" >
<ListBox.Resources>
<Style TargetType="ScrollViewer" BasedOn="{StaticResource MaterialDesignScrollViewer}" />
<Style TargetType="ScrollBar" BasedOn="{StaticResource MaterialDesignScrollBarMinimal}" />
<DataTemplate DataType="{x:Type dto:DownLoadDto}">
<Grid Background="{StaticResource ThemeColor}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="{Binding index}" />
</Grid>
<Grid Grid.Column="1">
<WrapPanel >
<Image Source="{Binding Image}" Width="40"/>
<StackPanel Margin="10,0,0,0">
<TextBlock Text="{Binding Name}"/>
<TextBlock Text="{Binding Des}" />
</StackPanel>
</WrapPanel>
</Grid>
<Grid Grid.Column="2">
<TextBlock Text="{Binding Album}" />
</Grid>
<Grid Grid.Column="3">
<Path Data="M0,0 L100,0 L100,100 L0,100 Z " Fill="Red" Stroke="Red" Stretch="Fill" Width="16" Height="16"/>
</Grid>
<Grid Grid.Column="4">
<TextBlock Text="{Binding Size}"/>
</Grid>
</Grid>
</DataTemplate>
</ListBox.Resources>
</ListBox>
I wish the content in the Datatemple would be filled in the proportion I set but in fact they are very close together. This problem annoys me very much and I would love to get your answer
I try to set up HorizontalContentAlignment = “Stretch” the result is close together
This is what I would expect:
This style uses a fixed width, I want the style to be proportional to the swing