Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight列表框:如何确定用户当前是否正在拖动滚动条滑块?_Silverlight_Listbox_Slider_Scrollbar - Fatal编程技术网

Silverlight列表框:如何确定用户当前是否正在拖动滚动条滑块?

Silverlight列表框:如何确定用户当前是否正在拖动滚动条滑块?,silverlight,listbox,slider,scrollbar,Silverlight,Listbox,Slider,Scrollbar,场景:我有一个列表框,其中包含Silverlight Toolkit中的一个WrapPanel作为ItemsPanel: <ListBox x:Name="listBoxFaelle"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <toolkit:WrapPanel /> </ItemsPanelTemplate> <

场景:我有一个列表框,其中包含Silverlight Toolkit中的一个WrapPanel作为ItemsPanel:

<ListBox x:Name="listBoxFaelle">
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <toolkit:WrapPanel />
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
    <ListBox.Template>
        <ControlTemplate>
            <Grid>
                <ScrollViewer>
                    <ItemsPresenter />
                </ScrollViewer>
            </Grid>
        </ControlTemplate>
    </ListBox.Template>
</ListBox>

此列表框每60秒自动填充一次RIA服务调用的结果。当应用程序等待LoadOperation完成时,它会显示作为Silverlight业务应用程序模板一部分的标准BusyIndicator

只要用户在触发计时器事件时不拖动列表框的滚动条滑块,这就可以正常工作

问题:如果用户在显示BusyIndicator时拖动滚动条滑块,则滚动条随后不再工作。看起来,即使松开鼠标左键,鼠标指针仍会捕捉到滑块。我认为这是因为BusyIndicator在拖动滑块时会暂时将焦点从滑块上移开


问题:有没有办法确定列表框的滚动条滑块当前是否被按下?

据我所知,没有状态/属性来确定滑块是否被按下

<>你说你可以通过处理事件来跟踪它,但是你也必须考虑其他事件,这取决于你的场景(鼠标轮)

鼠标(或手写笔)位于UIElement上方(或UIElement保持鼠标捕捉)时,松开鼠标左键(或从平板电脑上取下手写笔尖端)时,会发生MouseLeftButtonUp。(从UIElement继承。)

也可以通过另一种方法解决这个问题,方法是使用


同样,这取决于您希望从用户的角度发生什么:跳过数据加载(这是我更喜欢的,因为我不喜欢滚动时内容发生变化),或者重置列表框并滚动到顶部(我认为很难看)

谢谢,Erno。我同意最好在用户滚动时跳过数据加载。不幸的是,Silverlight不支持IsMouseCaptured属性。我还尝试了ReleaseMouseCapture(),但找不到相应控件的引用。如何在控件层次结构中找到实际的滚动条?与此同时,我发现GridSplitter控件也出现了同样的问题。我想我最好不要用公交指示灯。啊,是的,silverlight。。。抱歉,我一直在阅读Silverlight和WPF的帮助。我也怀疑忙指示灯。要找到滚动条,恐怕您必须搜索模板。