如何知道我何时到达终点

时间:2014-11-12 21:43:06

标签: c# wpf xaml scrollviewer repeatbutton

我有这个使用模板的触摸屏wpf应用程序,我需要知道当我在列表的末尾使用scrollviewer和Repeat按钮时,我需要对一些C#代码有一个钩子我已经尝试了很多不同的东西(我是wpf的新手)但没有什么工作。我想我需要附加setter的Collapsed值。以下是我试图解释的代码段。

<Grid DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" Background="LightCyan" >
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="50*"/>
        <ColumnDefinition Width="auto"/>
        <ColumnDefinition Width="50*"/>               
    </Grid.ColumnDefinitions>
        <Grid.Style>
        <Style TargetType="{x:Type Grid}" >
            <Setter Property="Visibility" Value="Visible"></Setter>
            <Style.Triggers>
                <DataTrigger Value="True">
                    <DataTrigger.Binding>
                        <MultiBinding Converter="{StaticResource areValuesGreaterThanOrEqual}">
                            <Binding ElementName="scrollviewer" Path="VerticalOffset"></Binding>
                            <Binding ElementName="scrollviewer" Path="ScrollableHeight"></Binding>
                        </MultiBinding>                                    
                    </DataTrigger.Binding>
                    <Setter Property="Visibility" Value="Collapsed"></Setter>                              
                </DataTrigger>
            </Style.Triggers>                        
        </Style>
    </Grid.Style>

    <Button x:Name="EndNavigation"
        VerticalAlignment="Center" Content="END" HorizontalAlignment="Right" Grid.Column="0"
        Command="{x:Static ScrollBar.ScrollToBottomCommand}" Margin="5 0 5 0"  
        Style="{StaticResource NavigationBlueButtonStyle}" 
        CommandTarget="{Binding ElementName=scrollviewer}">
    </Button>


    <RepeatButton x:Name="LineDownButton" Width="250" HorizontalAlignment="Center" Grid.Column="1"
        VerticalAlignment="Center" 
        Template="{StaticResource downArrowInBox}"
        Command="{x:Static ScrollBar.LineDownCommand}"      
        CommandTarget="{Binding ElementName=scrollviewer}">
    </RepeatButton>

    <RepeatButton x:Name="PageDownButton" Margin="5 0 0 0" VerticalAlignment="Center" Grid.Column="2"
        HorizontalAlignment="Left" Content="PAGE DOWN"
        Style="{StaticResource NavigationBlueRepeatButtonStyle}" 
        Command="{x:Static ScrollBar.PageDownCommand}"      
        CommandTarget="{Binding ElementName=scrollviewer}">              
    </RepeatButton>
</Grid>

0 个答案:

没有答案