带有列表视图的视图框 [英] view box with list view

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

问题描述

您好,我正在与View box控件一起使用,以便更改控件的大小,这将重新调整页面的大小,尤其是在更改页面大小时,尤其是标签和标签字体的大小,为此,我确实使用了ViewBox:

Hi all i am working with View box control in order to change controls size will resizing the page and specially labels and label font size when page resizing most be changed, for this i did use ViewBox :

<viewbox>
<Label content="Test" />
</viewbox>



现在,每个人都认为可以.但是当我想将ViewBox与ListView一起使用时,会出现很多错误的想法,
第一个ListView显示所有项目,无论项目计数如何,都没有滚动条.

当我在listview项的文本框中书写内容时,列表视图会改变其大小.
还有很多其他问题:
有我的代码:
如果有错误,请告诉我在哪里,以及是否有其他想法请告诉我.
注意:我确实尝试将视图框放在listview项上,但发现的结果相同:

这是listviewItem样式:



for now every think is ok. But when i want to use ViewBox With ListView many bad thinks appear,
first ListView show all item whatever items count, without scroll bar.

when i writ in a textbox in listview item the list view chage it''s size .
and many and many other problems:
there is my code:
if there are error plz tell me where and if there are another idea plz tell me about it.
note: i did try to put the view box on listview item but the same result i did found:

this is listviewItem Style :

<Style x:Key="ItemsStyle" TargetType="{x:Type ListViewItem}">
<setter property="Height" value="40" />
<setter property="Margin" value="2" />
<setter property="Template">
<setter.value>
<controltemplate>
                        
<dockpanel lastchildfill="True" removed="Aquamarine">
<viewbox verticalalignment="Stretch">
<Label Content="{Binding Path=Id}" DockPanel.Dock="Left"  />
</viewbox>

<viewbox verticalalignment="Stretch">
<textbox text="{Binding Path=Desc}" grid.row="0" grid.column="1" borderbrush="Transparent" borderthickness="0">
removed="Transparent"  /&gt;
</textbox></viewbox>
</dockpanel>
                        
</controltemplate>
</setter.value>
</setter>



这是我的XAML代码:



and this is my XAML code:

<grid>
<grid.rowdefinitions>
<rowdefinition height="10*" />
<rowdefinition height="80*" />
<rowdefinition height="10*" />
</grid.rowdefinitions>
<grid.columndefinitions>
<columndefinition width="20*" />
<columndefinition width="60*" />
<columndefinition width="20*" />
</grid.columndefinitions>

<viewbox stretch="UniformToFill" grid.column="1" grid.row="1"> 
<listview name="listView1" itemcontainerstyle="{StaticResource ItemsStyle}" itemssource="{Binding Path=LST}" grid.column="1" grid.row="1" />
</viewbox>
</grid>

推荐答案

似乎您只是滥用装饰器System.Windows.Controls.Viewbox并期望无法预期的结果,因为此类的属性和用法非常不同超出您的预期:
http://msdn.microsoft.com/en-us/library/system. windows.controls.viewbox.aspx [ ^ ].

无论它是什么,此装饰器都可以简单地缩放其内容. If主要用于矢量图形,但可以用于任何图形.如果您主要基于类似文本的视图来放置一些控件,则该行为将看起来很好……很奇特. :-)

关于一些建设性的建议,如果您清楚地说明您的目的(包括应用程序的最终目标),则可以得到建议.

—SA
It looks like you simply abuse the decorator System.Windows.Controls.Viewbox and expect the results which cannot be expected, because the property and use of this class are very different from what you expected:
http://msdn.microsoft.com/en-us/library/system.windows.controls.viewbox.aspx[^].

This decorator simply scale its content, no matter what is it. If is primarily used on vector graphics but can be used on anything. If you put some control mainly based on text-like views, the behavior would look, well… exotic. :-)

As to some constructive advice, you could get it if you clearly explain your purpose, including the ultimate goals of your application.

—SA


这篇关于带有列表视图的视图框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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