我有ItemsControl
,關聯的DataTemplate
如下所示。我的問題是如何在ItemsControl
中設置不同的第N個項目?我試圖只在某些項目上放置邊界。ItemsControl中的樣式第N個項目
<DataTemplate x:Key="CTemplate">
<Grid HorizontalAlignment="Left" Width="200" Height="Auto" Margin="0,0,30,30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0">
<TextBlock Text="Device Name:" Style="{StaticResource i2_TB}"/>
<TextBlock Text="Device ID:" Style="{StaticResource i2_TB}" />
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Column="2">
<TextBlock Text="{Binding DeviceName}" Style="{StaticResource i2_TB}" TextTrimming="CharacterEllipsis" />
<TextBlock Text="{Binding DeviceID}" Style="{StaticResource i2_TB}" TextTrimming="CharacterEllipsis" />
</StackPanel>
</Grid>
</DataTemplate>
這可能會有所幫助:HTTP:// stackoverflow.com/questions/660528/how-to-display-row-numbers-in-a-listview – Damian