阅读背景:

如何停止在数据绑定上触发滚动更改事件(WPF)

来源:互联网 

                </ItemsControl.ItemTemplate>
                <ItemsControl.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.ContainerStyle>
                            <Style TargetType="GroupItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="GroupItem">
                                            <Grid>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition/>
                                                    <RowDefinition/>
                                                </Grid.RowDefinitions>
                                                <TextBlock Grid.Row="0" HorizontalAlignment="Center"  FontWeight="Bold"  Foreground="{StaticResource Accent}" Text="{Binding Path=Name , StringFormat={}{0:D}}"  />
                                                <ItemsPresenter Grid.Row="1"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </GroupStyle.ContainerStyle>
                    </GroupStyle>
                </ItemsControl.GroupStyle>
            </ItemsControl>
            <Interactivity:Interaction.Triggers>
                <Interactivity:EventTrigger EventName="ScrollChanged" >
                    <Presentation:InvokeDelegateCommandAction  Command="{Binding ChatScrollViewer_OnViewChange}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}" />
                </Interactivity:EventTrigger>
            </Interactivity:Interaction.Triggers>
        </ScrollViewer>



private void ChatScrollViewer_OnViewChangeEvent(ScrollChangedEventArgs Event)
    {
        ScrollViewer scrollViewer = Event.OriginalSource as ScrollViewer;
        if (scrollViewer.VerticalOffset == 0)
        {

        }
    }
                </ItemsControl.ItemTemplate



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: