Add items to combobox in WPF within a canvas
Good day,
I want to add specific items to my combobox, but am running into an error.
Code:
Add-Type -AssemblyName PresentationFramework
[xml]$Form = @"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Printer GUI" Height="465" Width="375">
<Canvas Background="White">
<Label Name="label_username" Content="Username" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top"/>
<Label Name="label_Location" Content="Select Location" HorizontalAlignment="Left" Margin="170,30,0,0" VerticalAlignment="Top"/>
<TextBox Name="textbox_username" HorizontalAlignment="Left" Height="23" Margin="30,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160"/>
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
<Label Name="label_printer" Content="Please select printer from list" HorizontalAlignment="Left" Margin="30,105,0,0" VerticalAlignment="Top"/>
<ComboBox Name="ComboBox_Printer" HorizontalAlignment="Left" Margin="30,131,0,0" VerticalAlignment="Top" Width="300"/>
<CheckBox Name="CheckBox" Content="Check here if you want to add this printer
to your permanent list" HorizontalAlignment="Left" Margin="56,185,0,0" VerticalAlignment="Top" Height="39" Width="245"/>
<Button Name="Button_Add" Content="Add Printer" Margin="140,244,140,150" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_XPS" Content="Printer Defaults issue
in Practice Partner" Margin="90,285,90,102" Width="175" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ClickMode="Release" VerticalAlignment="Center"/>
<Button Name="Button_Service" Content="Service call for Printer" Margin="113,343,110,51" Width="130" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_Cancel" Content="Cancel" Margin="140,384,140,10" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
</Canvas>
</Window>
"@
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$Win=[Windows.Markup.XamlReader]::Load($NR)
$Win.Showdialog()
As you see, I tried to add items, but the error is as follows;
Cannot convert value "<Window xmlns=...</Window>" to type "System.Xml.XmlDocument".
Error: "The 'Canvas' start tag on line 4 position 6 does not match the end tag of
'ComboBox'. Line 12, position 11."
At H:ScriptsForm_Main_XAML.ps1:3 char:1
+ [xml]$Form = @"
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) , ArgumentTransformationMetadataException
+ FullyQualifiedErrorId : RuntimeException
This is my first time in Visual Studios, and this code has been a WinForms before this. Thank you all in advance.
c# xml wpf xaml combobox
add a comment |
Good day,
I want to add specific items to my combobox, but am running into an error.
Code:
Add-Type -AssemblyName PresentationFramework
[xml]$Form = @"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Printer GUI" Height="465" Width="375">
<Canvas Background="White">
<Label Name="label_username" Content="Username" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top"/>
<Label Name="label_Location" Content="Select Location" HorizontalAlignment="Left" Margin="170,30,0,0" VerticalAlignment="Top"/>
<TextBox Name="textbox_username" HorizontalAlignment="Left" Height="23" Margin="30,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160"/>
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
<Label Name="label_printer" Content="Please select printer from list" HorizontalAlignment="Left" Margin="30,105,0,0" VerticalAlignment="Top"/>
<ComboBox Name="ComboBox_Printer" HorizontalAlignment="Left" Margin="30,131,0,0" VerticalAlignment="Top" Width="300"/>
<CheckBox Name="CheckBox" Content="Check here if you want to add this printer
to your permanent list" HorizontalAlignment="Left" Margin="56,185,0,0" VerticalAlignment="Top" Height="39" Width="245"/>
<Button Name="Button_Add" Content="Add Printer" Margin="140,244,140,150" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_XPS" Content="Printer Defaults issue
in Practice Partner" Margin="90,285,90,102" Width="175" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ClickMode="Release" VerticalAlignment="Center"/>
<Button Name="Button_Service" Content="Service call for Printer" Margin="113,343,110,51" Width="130" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_Cancel" Content="Cancel" Margin="140,384,140,10" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
</Canvas>
</Window>
"@
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$Win=[Windows.Markup.XamlReader]::Load($NR)
$Win.Showdialog()
As you see, I tried to add items, but the error is as follows;
Cannot convert value "<Window xmlns=...</Window>" to type "System.Xml.XmlDocument".
Error: "The 'Canvas' start tag on line 4 position 6 does not match the end tag of
'ComboBox'. Line 12, position 11."
At H:ScriptsForm_Main_XAML.ps1:3 char:1
+ [xml]$Form = @"
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) , ArgumentTransformationMetadataException
+ FullyQualifiedErrorId : RuntimeException
This is my first time in Visual Studios, and this code has been a WinForms before this. Thank you all in advance.
c# xml wpf xaml combobox
add a comment |
Good day,
I want to add specific items to my combobox, but am running into an error.
Code:
Add-Type -AssemblyName PresentationFramework
[xml]$Form = @"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Printer GUI" Height="465" Width="375">
<Canvas Background="White">
<Label Name="label_username" Content="Username" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top"/>
<Label Name="label_Location" Content="Select Location" HorizontalAlignment="Left" Margin="170,30,0,0" VerticalAlignment="Top"/>
<TextBox Name="textbox_username" HorizontalAlignment="Left" Height="23" Margin="30,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160"/>
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
<Label Name="label_printer" Content="Please select printer from list" HorizontalAlignment="Left" Margin="30,105,0,0" VerticalAlignment="Top"/>
<ComboBox Name="ComboBox_Printer" HorizontalAlignment="Left" Margin="30,131,0,0" VerticalAlignment="Top" Width="300"/>
<CheckBox Name="CheckBox" Content="Check here if you want to add this printer
to your permanent list" HorizontalAlignment="Left" Margin="56,185,0,0" VerticalAlignment="Top" Height="39" Width="245"/>
<Button Name="Button_Add" Content="Add Printer" Margin="140,244,140,150" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_XPS" Content="Printer Defaults issue
in Practice Partner" Margin="90,285,90,102" Width="175" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ClickMode="Release" VerticalAlignment="Center"/>
<Button Name="Button_Service" Content="Service call for Printer" Margin="113,343,110,51" Width="130" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_Cancel" Content="Cancel" Margin="140,384,140,10" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
</Canvas>
</Window>
"@
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$Win=[Windows.Markup.XamlReader]::Load($NR)
$Win.Showdialog()
As you see, I tried to add items, but the error is as follows;
Cannot convert value "<Window xmlns=...</Window>" to type "System.Xml.XmlDocument".
Error: "The 'Canvas' start tag on line 4 position 6 does not match the end tag of
'ComboBox'. Line 12, position 11."
At H:ScriptsForm_Main_XAML.ps1:3 char:1
+ [xml]$Form = @"
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) , ArgumentTransformationMetadataException
+ FullyQualifiedErrorId : RuntimeException
This is my first time in Visual Studios, and this code has been a WinForms before this. Thank you all in advance.
c# xml wpf xaml combobox
Good day,
I want to add specific items to my combobox, but am running into an error.
Code:
Add-Type -AssemblyName PresentationFramework
[xml]$Form = @"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Printer GUI" Height="465" Width="375">
<Canvas Background="White">
<Label Name="label_username" Content="Username" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top"/>
<Label Name="label_Location" Content="Select Location" HorizontalAlignment="Left" Margin="170,30,0,0" VerticalAlignment="Top"/>
<TextBox Name="textbox_username" HorizontalAlignment="Left" Height="23" Margin="30,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160"/>
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
<Label Name="label_printer" Content="Please select printer from list" HorizontalAlignment="Left" Margin="30,105,0,0" VerticalAlignment="Top"/>
<ComboBox Name="ComboBox_Printer" HorizontalAlignment="Left" Margin="30,131,0,0" VerticalAlignment="Top" Width="300"/>
<CheckBox Name="CheckBox" Content="Check here if you want to add this printer
to your permanent list" HorizontalAlignment="Left" Margin="56,185,0,0" VerticalAlignment="Top" Height="39" Width="245"/>
<Button Name="Button_Add" Content="Add Printer" Margin="140,244,140,150" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_XPS" Content="Printer Defaults issue
in Practice Partner" Margin="90,285,90,102" Width="175" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ClickMode="Release" VerticalAlignment="Center"/>
<Button Name="Button_Service" Content="Service call for Printer" Margin="113,343,110,51" Width="130" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_Cancel" Content="Cancel" Margin="140,384,140,10" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
</Canvas>
</Window>
"@
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$Win=[Windows.Markup.XamlReader]::Load($NR)
$Win.Showdialog()
As you see, I tried to add items, but the error is as follows;
Cannot convert value "<Window xmlns=...</Window>" to type "System.Xml.XmlDocument".
Error: "The 'Canvas' start tag on line 4 position 6 does not match the end tag of
'ComboBox'. Line 12, position 11."
At H:ScriptsForm_Main_XAML.ps1:3 char:1
+ [xml]$Form = @"
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) , ArgumentTransformationMetadataException
+ FullyQualifiedErrorId : RuntimeException
This is my first time in Visual Studios, and this code has been a WinForms before this. Thank you all in advance.
c# xml wpf xaml combobox
c# xml wpf xaml combobox
asked Nov 13 '18 at 22:53
Megamidget3Megamidget3
346
346
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Your block that says:
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160"/>
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
The first line ends in a />, in which that closing tag designates the end of your ComboBox definition. Instead, you want to end it with > and let your corresponding </ComboBox> line close your block.
Thank you @Chris. I should've known it was a simple fix. I need to watch my openings and closings. Thank you for the explination!
– Megamidget3
Nov 14 '18 at 14:36
1
@Megamidget3 No problem at all! Was by far one of my small annoyances when first learning XAML in VS. instinctively typing/to finish a tag, because it auto populates the>. My suggestion would be to get in a habit of creating your control,<ComboBoxand if you know you’re going to have children nodes, immediately type>so that it auto fills the</ComboBox>for you and space it out so that it gives you a visual cue to put sub items in there.
– Chris
Nov 14 '18 at 14:50
add a comment |
Your XAML combobox had a closing tag when it shouldn't:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Printer GUI" Height="465" Width="375">
<Canvas Background="White">
<Label Name="label_username" Content="Username" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top"/>
<Label Name="label_Location" Content="Select Location" HorizontalAlignment="Left" Margin="170,30,0,0" VerticalAlignment="Top"/>
<TextBox Name="textbox_username" HorizontalAlignment="Left" Height="23" Margin="30,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160">
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
<Label Name="label_printer" Content="Please select printer from list" HorizontalAlignment="Left" Margin="30,105,0,0" VerticalAlignment="Top"/>
<ComboBox Name="ComboBox_Printer" HorizontalAlignment="Left" Margin="30,131,0,0" VerticalAlignment="Top" Width="300"/>
<CheckBox Name="CheckBox" Content="Check here if you want to add this printer
to your permanent list" HorizontalAlignment="Left" Margin="56,185,0,0" VerticalAlignment="Top" Height="39" Width="245"/>
<Button Name="Button_Add" Content="Add Printer" Margin="140,244,140,150" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_XPS" Content="Printer Defaults issue
in Practice Partner" Margin="90,285,90,102" Width="175" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ClickMode="Release" VerticalAlignment="Center"/>
<Button Name="Button_Service" Content="Service call for Printer" Margin="113,343,110,51" Width="130" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_Cancel" Content="Cancel" Margin="140,384,140,10" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
</Canvas>
</Window>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290723%2fadd-items-to-combobox-in-wpf-within-a-canvas%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your block that says:
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160"/>
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
The first line ends in a />, in which that closing tag designates the end of your ComboBox definition. Instead, you want to end it with > and let your corresponding </ComboBox> line close your block.
Thank you @Chris. I should've known it was a simple fix. I need to watch my openings and closings. Thank you for the explination!
– Megamidget3
Nov 14 '18 at 14:36
1
@Megamidget3 No problem at all! Was by far one of my small annoyances when first learning XAML in VS. instinctively typing/to finish a tag, because it auto populates the>. My suggestion would be to get in a habit of creating your control,<ComboBoxand if you know you’re going to have children nodes, immediately type>so that it auto fills the</ComboBox>for you and space it out so that it gives you a visual cue to put sub items in there.
– Chris
Nov 14 '18 at 14:50
add a comment |
Your block that says:
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160"/>
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
The first line ends in a />, in which that closing tag designates the end of your ComboBox definition. Instead, you want to end it with > and let your corresponding </ComboBox> line close your block.
Thank you @Chris. I should've known it was a simple fix. I need to watch my openings and closings. Thank you for the explination!
– Megamidget3
Nov 14 '18 at 14:36
1
@Megamidget3 No problem at all! Was by far one of my small annoyances when first learning XAML in VS. instinctively typing/to finish a tag, because it auto populates the>. My suggestion would be to get in a habit of creating your control,<ComboBoxand if you know you’re going to have children nodes, immediately type>so that it auto fills the</ComboBox>for you and space it out so that it gives you a visual cue to put sub items in there.
– Chris
Nov 14 '18 at 14:50
add a comment |
Your block that says:
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160"/>
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
The first line ends in a />, in which that closing tag designates the end of your ComboBox definition. Instead, you want to end it with > and let your corresponding </ComboBox> line close your block.
Your block that says:
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160"/>
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
The first line ends in a />, in which that closing tag designates the end of your ComboBox definition. Instead, you want to end it with > and let your corresponding </ComboBox> line close your block.
answered Nov 13 '18 at 23:08
ChrisChris
1,686418
1,686418
Thank you @Chris. I should've known it was a simple fix. I need to watch my openings and closings. Thank you for the explination!
– Megamidget3
Nov 14 '18 at 14:36
1
@Megamidget3 No problem at all! Was by far one of my small annoyances when first learning XAML in VS. instinctively typing/to finish a tag, because it auto populates the>. My suggestion would be to get in a habit of creating your control,<ComboBoxand if you know you’re going to have children nodes, immediately type>so that it auto fills the</ComboBox>for you and space it out so that it gives you a visual cue to put sub items in there.
– Chris
Nov 14 '18 at 14:50
add a comment |
Thank you @Chris. I should've known it was a simple fix. I need to watch my openings and closings. Thank you for the explination!
– Megamidget3
Nov 14 '18 at 14:36
1
@Megamidget3 No problem at all! Was by far one of my small annoyances when first learning XAML in VS. instinctively typing/to finish a tag, because it auto populates the>. My suggestion would be to get in a habit of creating your control,<ComboBoxand if you know you’re going to have children nodes, immediately type>so that it auto fills the</ComboBox>for you and space it out so that it gives you a visual cue to put sub items in there.
– Chris
Nov 14 '18 at 14:50
Thank you @Chris. I should've known it was a simple fix. I need to watch my openings and closings. Thank you for the explination!
– Megamidget3
Nov 14 '18 at 14:36
Thank you @Chris. I should've known it was a simple fix. I need to watch my openings and closings. Thank you for the explination!
– Megamidget3
Nov 14 '18 at 14:36
1
1
@Megamidget3 No problem at all! Was by far one of my small annoyances when first learning XAML in VS. instinctively typing
/ to finish a tag, because it auto populates the >. My suggestion would be to get in a habit of creating your control, <ComboBox and if you know you’re going to have children nodes, immediately type > so that it auto fills the </ComboBox> for you and space it out so that it gives you a visual cue to put sub items in there.– Chris
Nov 14 '18 at 14:50
@Megamidget3 No problem at all! Was by far one of my small annoyances when first learning XAML in VS. instinctively typing
/ to finish a tag, because it auto populates the >. My suggestion would be to get in a habit of creating your control, <ComboBox and if you know you’re going to have children nodes, immediately type > so that it auto fills the </ComboBox> for you and space it out so that it gives you a visual cue to put sub items in there.– Chris
Nov 14 '18 at 14:50
add a comment |
Your XAML combobox had a closing tag when it shouldn't:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Printer GUI" Height="465" Width="375">
<Canvas Background="White">
<Label Name="label_username" Content="Username" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top"/>
<Label Name="label_Location" Content="Select Location" HorizontalAlignment="Left" Margin="170,30,0,0" VerticalAlignment="Top"/>
<TextBox Name="textbox_username" HorizontalAlignment="Left" Height="23" Margin="30,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160">
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
<Label Name="label_printer" Content="Please select printer from list" HorizontalAlignment="Left" Margin="30,105,0,0" VerticalAlignment="Top"/>
<ComboBox Name="ComboBox_Printer" HorizontalAlignment="Left" Margin="30,131,0,0" VerticalAlignment="Top" Width="300"/>
<CheckBox Name="CheckBox" Content="Check here if you want to add this printer
to your permanent list" HorizontalAlignment="Left" Margin="56,185,0,0" VerticalAlignment="Top" Height="39" Width="245"/>
<Button Name="Button_Add" Content="Add Printer" Margin="140,244,140,150" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_XPS" Content="Printer Defaults issue
in Practice Partner" Margin="90,285,90,102" Width="175" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ClickMode="Release" VerticalAlignment="Center"/>
<Button Name="Button_Service" Content="Service call for Printer" Margin="113,343,110,51" Width="130" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_Cancel" Content="Cancel" Margin="140,384,140,10" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
</Canvas>
</Window>
add a comment |
Your XAML combobox had a closing tag when it shouldn't:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Printer GUI" Height="465" Width="375">
<Canvas Background="White">
<Label Name="label_username" Content="Username" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top"/>
<Label Name="label_Location" Content="Select Location" HorizontalAlignment="Left" Margin="170,30,0,0" VerticalAlignment="Top"/>
<TextBox Name="textbox_username" HorizontalAlignment="Left" Height="23" Margin="30,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160">
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
<Label Name="label_printer" Content="Please select printer from list" HorizontalAlignment="Left" Margin="30,105,0,0" VerticalAlignment="Top"/>
<ComboBox Name="ComboBox_Printer" HorizontalAlignment="Left" Margin="30,131,0,0" VerticalAlignment="Top" Width="300"/>
<CheckBox Name="CheckBox" Content="Check here if you want to add this printer
to your permanent list" HorizontalAlignment="Left" Margin="56,185,0,0" VerticalAlignment="Top" Height="39" Width="245"/>
<Button Name="Button_Add" Content="Add Printer" Margin="140,244,140,150" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_XPS" Content="Printer Defaults issue
in Practice Partner" Margin="90,285,90,102" Width="175" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ClickMode="Release" VerticalAlignment="Center"/>
<Button Name="Button_Service" Content="Service call for Printer" Margin="113,343,110,51" Width="130" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_Cancel" Content="Cancel" Margin="140,384,140,10" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
</Canvas>
</Window>
add a comment |
Your XAML combobox had a closing tag when it shouldn't:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Printer GUI" Height="465" Width="375">
<Canvas Background="White">
<Label Name="label_username" Content="Username" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top"/>
<Label Name="label_Location" Content="Select Location" HorizontalAlignment="Left" Margin="170,30,0,0" VerticalAlignment="Top"/>
<TextBox Name="textbox_username" HorizontalAlignment="Left" Height="23" Margin="30,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160">
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
<Label Name="label_printer" Content="Please select printer from list" HorizontalAlignment="Left" Margin="30,105,0,0" VerticalAlignment="Top"/>
<ComboBox Name="ComboBox_Printer" HorizontalAlignment="Left" Margin="30,131,0,0" VerticalAlignment="Top" Width="300"/>
<CheckBox Name="CheckBox" Content="Check here if you want to add this printer
to your permanent list" HorizontalAlignment="Left" Margin="56,185,0,0" VerticalAlignment="Top" Height="39" Width="245"/>
<Button Name="Button_Add" Content="Add Printer" Margin="140,244,140,150" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_XPS" Content="Printer Defaults issue
in Practice Partner" Margin="90,285,90,102" Width="175" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ClickMode="Release" VerticalAlignment="Center"/>
<Button Name="Button_Service" Content="Service call for Printer" Margin="113,343,110,51" Width="130" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_Cancel" Content="Cancel" Margin="140,384,140,10" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
</Canvas>
</Window>
Your XAML combobox had a closing tag when it shouldn't:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Printer GUI" Height="465" Width="375">
<Canvas Background="White">
<Label Name="label_username" Content="Username" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top"/>
<Label Name="label_Location" Content="Select Location" HorizontalAlignment="Left" Margin="170,30,0,0" VerticalAlignment="Top"/>
<TextBox Name="textbox_username" HorizontalAlignment="Left" Height="23" Margin="30,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<ComboBox Name="ComboBox_Location" HorizontalAlignment="Left" Margin="170,56,0,0" VerticalAlignment="Top" Width="160">
<ComboBoxItem Content="X"/>
<ComboBoxItem Content="Y"/>
<ComboBoxItem Content="Z"/>
</ComboBox>
<Label Name="label_printer" Content="Please select printer from list" HorizontalAlignment="Left" Margin="30,105,0,0" VerticalAlignment="Top"/>
<ComboBox Name="ComboBox_Printer" HorizontalAlignment="Left" Margin="30,131,0,0" VerticalAlignment="Top" Width="300"/>
<CheckBox Name="CheckBox" Content="Check here if you want to add this printer
to your permanent list" HorizontalAlignment="Left" Margin="56,185,0,0" VerticalAlignment="Top" Height="39" Width="245"/>
<Button Name="Button_Add" Content="Add Printer" Margin="140,244,140,150" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_XPS" Content="Printer Defaults issue
in Practice Partner" Margin="90,285,90,102" Width="175" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ClickMode="Release" VerticalAlignment="Center"/>
<Button Name="Button_Service" Content="Service call for Printer" Margin="113,343,110,51" Width="130" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
<Button Name="Button_Cancel" Content="Cancel" Margin="140,384,140,10" Width="75" Height="25" VerticalAlignment="Center" ClickMode="Release"/>
</Canvas>
</Window>
answered Nov 13 '18 at 23:08
Clayton HarbichClayton Harbich
272513
272513
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290723%2fadd-items-to-combobox-in-wpf-within-a-canvas%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown