数据模板的虚拟化和数据触发

                                    <ItemsControl Margin="0,10,0,0" ItemsSource="{Binding SpotCheckData}">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <VirtualizingStackPanel
                                                    Orientation="Vertical"
                                                    IsVirtualizing="True"
                                                    VirtualizationMode="Recycling"
                                                    VirtualizingPanel.CacheLength="25"/>
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>

                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate DataType="{x:Type Models:SpotCheckItemData}">
                                                <Grid Margin="55,0,0,0" Width="1110">
                                                    <Border
                                                        Name="flickerBorder"
                                                        Margin="0,0,0,0"
                                                        Height="40"
                                                        Width="1015"
                                                        CornerRadius="8"
                                                        BorderThickness="1"
                                                        HorizontalAlignment="Left"
                                                        VerticalAlignment="Top"
                                                        BorderBrush="Transparent"
                                                        Background="#FFD700"
                                                        Opacity="0">
                                                    </Border>
                                                    <StackPanel 
                                                        Margin="5,0,67,0"
                                                        Orientation="Horizontal"
                                                        Height="40">
                                                        <TextBlock
                                                            Width="45"
                                                            Margin="0,8,0,0"
                                                            TextAlignment="Center"
                                                            Text="{Binding PLCPointPosition}">
                                                        </TextBlock>
                                                        <ToggleButton
                                                            Margin="26,10,0,0"
                                                            IsChecked="{Binding Result}"
                                                            IsEnabled="False"
                                                        <TextBlock
                                                            Margin="30,9,0,0"
                                                            Width="260"
                                                            Text="{Binding Name}">
                                                        </TextBlock>
                                                        <TextBox
                                                            Width="100"
                                                            Height="30"
                                                            Margin="25,5,0,0"
                                                            IsEnabled="False"
                                                            Text="{Binding TheoryCount}" />
                                                        <TextBox
                                                            Width="100"
                                                            Height="30"
                                                            Margin="25,5,0,0"
                                                            IsEnabled="False"
                                                            Text="{Binding RealCount}" />
                                                        <TextBox
                                                            Width="100"
                                                            Height="30"
                                                            Margin="25,5,0,0"
                                                            IsEnabled="False"
                                                            Text="{Binding TheoryHourCount}" />
                                                        <TextBox
                                                            Width="100"
                                                            Height="30"
                                                            Margin="25,5,0,0"
                                                            IsEnabled="False"
                                                            Text="{Binding RealHourCount}" />
                                                        <TextBox
                                                            Name="ThresholdValueTextBox"
                                                            Width="100"
                                                            Height="30"
                                                            Margin="25,5,0,0"
                                                            IsEnabled="False"
                                                            Foreground="{Binding ForegroundText,Mode=TwoWay}"
                                                            Text="{Binding ThresholdValue}" />
                                                    </StackPanel>
                                                </Grid>
                                                <DataTemplate.Triggers>
                                                    <DataTrigger Binding="{Binding Path=ThresholdValue,Converter={StaticResource ThresholdValueConverter}}">
                                                        <DataTrigger.Value>true</DataTrigger.Value>
                                                        <DataTrigger.EnterActions>
                                                            <BeginStoryboard Name="flickerStoryboard">
                                                                <Storyboard Storyboard.TargetName="flickerBorder" RepeatBehavior="Forever" AutoReverse="True" Timeline.DesiredFrameRate="20">
                                                                    <DoubleAnimation
                                                                    Storyboard.TargetProperty="Opacity"
                                                                    From="0" To="0.5" Duration="0:0:1.5"/>
                                                                </Storyboard>
                                                            </BeginStoryboard>
                                                        </DataTrigger.EnterActions>
                                                    </DataTrigger>
                                                    <DataTrigger Binding="{Binding Path=ThresholdValue,Converter={StaticResource ThresholdValueConverter}}">
                                                        <DataTrigger.Value>false</DataTrigger.Value>
                                                        <DataTrigger.EnterActions>
                                                            <RemoveStoryboard BeginStoryboardName="flickerStoryboard"></RemoveStoryboard>
                                                        </DataTrigger.EnterActions>
                                                    </DataTrigger>

                                                    <!--<DataTrigger Binding="{Binding Path=ThresholdValue,Converter={StaticResource ThresholdValueConverter}}" Value="False">
                                                        <Setter TargetName="ThresholdValueTextBox" Property="Foreground" Value="Red"/>
                                                    </DataTrigger>

                                                    <DataTrigger Binding="{Binding Path=ThresholdValue,Converter={StaticResource ThresholdValueConverter}}" Value="True">
                                                        <Setter TargetName="ThresholdValueTextBox" Property="Foreground" Value="#01E9FA"/>
                                                    </DataTrigger>-->
                                                </DataTemplate.Triggers>
                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                        <ItemsControl.Template>
                                            <ControlTemplate TargetType="ItemsControl">
                                                <ScrollViewer
                                                    Margin="0,0,0,0"
                                                    Width="1130"
                                                    Height="700"
                                                    VerticalScrollBarVisibility="Auto"
                                                    CanContentScroll="True"
                                                    SnapsToDevicePixels="True"
                                                    Style="{DynamicResource ParameterBorderScrollViewer}">
                                                    <ItemsPresenter />
                                                </ScrollViewer>
                                            </ControlTemplate>
                                        </ItemsControl.Template>
                                    </ItemsControl>
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值