<UserControl x:Class="MyApp.PrinterSelection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Printing="clr-namespace:System.Drawing.Printing;assembly=System.Drawing"
xmlns:local="clr-namespace:MyApp"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<ListBox x:Name="displayInstalledPrinterListView" HorizontalAlignment="Left" Height="311" Margin="10,0,0,0" VerticalAlignment="Top" Width="499" ItemsSource="{x:Static Printing:PrinterSettings.InstalledPrinters}" SelectionChanged="displayInstalledPrinterListView_SelectionChanged" AlternationCount="2" FontSize="16"/>
</Grid>
如何指定ListBox中的哪台打印机是使用XAML的默认打印机。如果用XAML无法做到这一点,那么最好的方法是什么?XAML显示哪个已安装的打印机是默认的
我知道我可以通过程序检查每台打印机来查看IsDefaultPrinter是否为true。不过,我想知道这是否可以用XAML(只)
点击此处查看此链接 - > http://stackoverflow.com/questions/86138/whats-the-best-way-to-get-the-default-printer-in-net那里有很好的信息 – waltmagic
is there一种使用XAML的IsDefaultPrinte方法? “使用XAML” –
“编程项目中仍然存在C#权利?亚历山大的答案应该适用于任何情况。在你的C#代码中应用Alexander的答案,你会发现成功。 – waltmagic