WPF组描述问题 [英] WPF GroupDescriptions Issue

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

问题描述

在我的应用程序中,我必须显示已安装的兼容打印机的列表.我已经安装了4台打印机,它显示如下:

In my application I have to show list of compatible printers installed. I have 4 printer installed and it shows like this:

如果有多台具有相同打印机类型的打印机,则将它们分组.但是,如果只有一台打印机具有一种打印机类型,那么我将像下面这样简单地显示它.这是我的下拉列表

If there are multiple printer with same printer type, then I group them. But if there is only one printer with one printer type then I simply show it like below. This is my drop down

打印机XLT 300(类型)

  • 打印机xlt 1(名称)
  • 打印机xlt 2(名称)
  • 打印机xlt 3(名称) ;(名称)

打印机XLT 500(类型)-打印机XLT 500 1(名称)

我使用此代码将其放在组中:

I use this code to put it in group : 

PrinterView.GroupDescriptions.Add(new PropertyGroupDescription("Type")));

PrinterView.GroupDescriptions.Add(new PropertyGroupDescription("Type"));

现在我的问题是:即使安装了一种类型的打印机,它也应显示如下:

Now my question is : even if there is one printer installed with one type it should show like below:

打印机XLT 500(类型)

  • 打印机XLT 500 1(名称)

我该怎么做?我必须对代码进行什么更改.我已经准备好处理此样式,但是您不知道要更改组说明"中的什么内容

How would I do that ? what change I have to make in code. I have style ready to handle that, jut don't know what to change in Group Descriptions

谢谢

Dee

推荐答案

您必须执行与具有多台打印机的打印机类型相同的操作.

you have to do the same as you do with the printer type that have multiple printers.


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

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