How to bind to the list of System.Drawing.Printing.PrinterSettings.InstalledPrinters, which is a static StringCollection, in WPF XAML. For example, to use it in a ComboBox, so a user can select the printer to use.
Add the namespace for System.Drawing.Print to your XAML code:
xmlns:Printing="clr-namespace:System.Drawing.Printing;assembly=System.Drawing"
Then add the combobox to show the list of printers installed on the system:
<ComboBox Name="cmbPrinterSelection" Width="300" ItemsSource="{x:Static Printing:PrinterSettings.InstalledPrinters}" SelectionChanged="cmbPrinterSelection_SelectionChanged" />
Hopefully this will save someone some time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With