我在ItemControl的数据模板中使用3个自定义控件,然后要在BackgroundWorker异步操作处理每个数据项里的控件的内容,代码如下:
这个是样式
<Style x:Key="GuestTilePanelStyle" TargetType="ItemsControl">
<Setter Property="xc:xTilePanel.ItemHeight" Value="30" />
<Setter Property="xc:xTilePanel.ItemWidth" Value="120" />
<Setter Property="ItemsControl.ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<xc:xTilePanel AnimatesNewItem="True" Attraction="2.0" Dampening="0.40" Variation="1.00" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemsControl.ItemTemplate">
<Setter.Value>
<DataTemplate>
<Grid x:Name="gProgressContainer" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<xc:xSprocket x:Name="skProgress" Grid.Column="0" Width="30" Height="30" TickColor="#FF02AA1A" />
<xc:xShadePanel x:Name="spInfo" Grid.Column="1" HorizontalContentAlignment="Center" Transition="UpTransition" />
<xc:xIcoButton x:Name="btnCancel" Grid.Column="2" Width="20" xIconSize="16" xIcon="/Takewin.OS.Modularity.FePlat;component/Resources/i0001000000210003.png" />
</Grid>
</DataTemplate>