WPF可视化问题 [英] WPF Visualization probleme

查看:106
本文介绍了WPF可视化问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个组合框问题,我确实给下摆2000件组合组合钉2秒钟,以显示他的选择列表
这是代码XAML:

Hi all,
I have a problem with combo box that i did give hem 2000 item the combo tack 2 sec to show his list for selection
this was the code XAML :

<combobox height="23" horizontalalignment="Left" margin="72,27,0,0" name="cmbTest">
     VerticalAlignment="Top" Width="120" >        
</combobox>


为了解决这个时间延迟,我确实使用了VirtualizingStackPanel,
添加VirtualizingStackPanel之后的代码是:


to fix this time delay i did use VirtualizingStackPanel ,
the code after adding VirtualizingStackPanel is:

<combobox height="23" horizontalalignment="Left" margin="72,27,0,0" name="cmbTest" scrollviewer.cancontentscroll="True">
                 VerticalAlignment="Top" Width="120" > 
            <combobox.itemspanel>
                <itemspaneltemplate>
                    <virtualizingstackpanel />
                </itemspaneltemplate>
            </combobox.itemspanel>
        </combobox>





如您所见,我确实添加了:





as you see i did add :

<combobox.itemspanel>
    <itemspaneltemplate>
        <virtualizingstackpanel />
    </itemspaneltemplate>
</combobox.itemspanel>




现在,此代码解决了性能问题,

在此之后,我想更改滚动行为,所以我确实设置了ScrollViewer.CanContentScroll ="false"以更改滚动行为.

修改之后,我确实失去了性能,

任何人都有解决此问题的想法,即可执行组合项目可视化并保持滚动行为

寻求帮助




now the performance problem is solved with this code,

after this i want to change the scroll behavior so i did set ScrollViewer.CanContentScroll="false" in order to change scroll behavior.

after this modification i did lose the performance ,

any one have idea to solve this , the combo item visualization be performed and kip the scroll behavior

thx for help

推荐答案

到目前为止,我知道,如果您取消选中 CanContentScroll ,您将失去虚拟化.有关更多详细信息,请查看该 [^]
So far i know, if you uncheck the CanContentScroll you will loose virtualization. For more details please have a look on that [^]


i did find the solution for this problem i did use this link :

http://stackoverflow.com/questions/1977929/wpf-listbox-with-a-listbox-ui-virtualization-and-scrolling/9875475?s=3b2992e5-728d-4508-a9c3-8ddb895e265a[^]

at the post that explain how to use PixelBasedScrollingBehavior class

all you need to do is to add this class in your solution and used it in the your XAMEL code


感谢您的帮助,我知道,我希望有一个解决方案,
我需要两个CanContentScroll都不会失去虚拟化.
thanks for your help I know this , and i want an idea to work around it ,
i need the both CanContentScroll without loosing virtualization.


这篇关于WPF可视化问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆