如何在WPF中将ListView标题向左对齐 [英] How to align listview heading to left in wpf

查看:310
本文介绍了如何在WPF中将ListView标题向左对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中的WPF中有一个列表视图.我想在其中保留每个列对齐的标题.例如名称类别等标题.
我有另一个查询,我有wpf表单,其中有一个文本框,我将在其中输入数字,然后单击提交"按钮,这将在列表视图中填充详细信息.我想通过输入数字后按Enter键来完成这项工作.
在此先感谢

[修改:删除了前置标签]

Hi I have a list view in WPF with C#. In which i want headers of every column alignment to be left. eg name class etc headings.
I have another query that I have wpf form in which i have a textbox in which i will input a number and click on submit button which will fill details in listview. I want do this job by hitting the enter buttons after inputting the number.
Thanks in advance

[Modified: removed the pre tags]

推荐答案

仅供参考,您通常应该在不同的帖子中提出不同的问题.您更有可能以这种方式回答他们.要回答第二个问题,您可以设置一个按键绑定,在这里进行说明:
FYI, you should typically ask different questions in different posts. You have a better chance of them being answered that way. To answer your second question, you can setup a key binding, which is explained here: http://social.msdn.microsoft.com/forums/en-US/wpf/thread/437cff55-2af5-4878-ab85-6fb3bbd636c4


我已将此作为进一步的参考资料

< pre lang ="xml">& lt; ListView Name =& quot; lvInvoiceDetails& quot;高度=&"200"前景=&白色& amp;"保证金=&"5,40,5,0&"& gt;

& lt; ListView.View& gt;
& lt; GridView& gt;
& lt; GridViewColumn Width =& quot; 200& quot; DisplayMemberBinding =&"{Binding InvoiceNo}&"& gt;
& lt; GridViewColumnHeader Content ="发票编号& quot; Horizo​​ntalContentAlignment =&左侧"/& gt;
& lt/GridViewColumn& gt;
& lt; GridViewColumn DisplayMemberBinding =& quot; {Binding Date}& quot;>
& lt; GridViewColumnHeader Content =&日期&" Horizo​​ntalContentAlignment =&左侧"/& gt;
& lt/GridViewColumn& gt;
& lt//GridView& gt;
& lt;/ListView.View& gt;
& lt//ListView& gt;</pre>

谢谢
I got this for further reference

<pre lang="xml">&lt;ListView Name=&quot;lvInvoiceDetails&quot; Height=&quot;200&quot; Foreground=&quot;White&quot; Margin=&quot;5,40,5,0&quot;&gt;

&lt;ListView.View&gt;
&lt;GridView&gt;
&lt;GridViewColumn Width=&quot;200&quot; DisplayMemberBinding=&quot;{Binding InvoiceNo}&quot;&gt;
&lt;GridViewColumnHeader Content=&quot;Invoice Number&quot; HorizontalContentAlignment=&quot;Left&quot;/&gt;
&lt;/GridViewColumn&gt;
&lt;GridViewColumn DisplayMemberBinding=&quot;{Binding Date}&quot;&gt;
&lt;GridViewColumnHeader Content=&quot;Date&quot; HorizontalContentAlignment=&quot;Left&quot;/&gt;
&lt;/GridViewColumn&gt;
&lt;/GridView&gt;
&lt;/ListView.View&gt;
&lt;/ListView&gt;</pre>

thank you


这篇关于如何在WPF中将ListView标题向左对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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