// Add the custom namesapce uri to the XML document. pdc.DocumentElement.SetAttribute("xmlns:contoso", "http://schemas.contoso.com/keywords"); // Add the custom media type. AddCustomMediaType(ref pdc, "http://schemas.contoso.com/keywords", "contoso:ContosoMediaType");
var comboBox = new ComboBox { // Header is displayed in the UI, ontop of the ComboBox. Header = feature.DisplayName }; // Construct a new List since IReadOnlyList does not support the 'IndexOf' method. var options = new ObservableCollection<PrintTicketOption>(feature.Options); // Provide the combo box with a list of options to select from. comboBox.ItemsSource = options; // Set the selected option to the option set in the print ticket. PrintTicketOption selectedOption;
// PDC の既定値を LocalStorageUtil から1回だけ読み込む string defaultOption = LocalStorageUtil.GetPdcDefaultValue(feature.Name); if (!LocalStorageUtil.IsAlreadyLoadedDefaultValue() && defaultOption != null) { selectedOption = options[0]; foreach (var option in options) { if (option.Name == defaultOption) { // デフォルト値 selectedOption = option; break; } } } else { var featureOption = feature.GetSelectedOption(); try { selectedOption = options.Single((option) => ( option.Name == featureOption.Name && option.XmlNamespace == featureOption.XmlNamespace)); } // Catch exceptions, because there can be multiple features with the "None" feature name. // We need to handle those features seperately. catch (System.SystemException exception) { var nameAttribute = featureOption.XmlNode.Attributes.GetNamedItem("name"); var attribute = featureOption.XmlNode.OwnerDocument.CreateAttribute("name");