title: Data-Binding in WPF (SCSM Incident Request Form)
body: <p>I am currently working on an SCSM (Microsoft Service Center Service Manager) 2012 project, in which I have to create a custom incident form for use within the console. I have tried to extend the existing form in the authoring tool, but found it too limited in function. Therefore I went down the  road of working on a completely new form in Visual Studio 2013 (I assume I cannot modify the existing Incident form assembly in VStudio otherwise that would probably make my job alot easier). I have completed the UI of the form, and imported it into the authoring tool to add some functions not present in VStudio (like list picker, etc.). Now I have to go back to the authoring tool (or Visual Studio depending on your answers) and focus on binding the textboxes and controls to actual data… here I kind of am lost. How do I go about doing this? I know I have to point the textbox for example a location on where to pull the data from, but where AM I pulling that data from anyways? For example, the status, the title, etc. These must all be bound to some data object somewhere in the SMDB (Service Manager Database) but that's as far as I know. Any guidance, pointers, tips, even links to documentation I can read would be greatly appreciated! I am a complete newbie at WPF and have been learning as I go, so if possible try to minimize the jargon and explain each step. Thanks in advance!</p>
  
  <h2><strong>CODE</strong></h2>
  
  <p>Incident_Request_Form.XAML.cs</p>
  
  <pre><code>    using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  /// using System.Threading.Tasks;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Data;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Imaging;
  using System.Windows.Navigation;
  using System.Windows.Shapes;
  
  namespace WpfControlLibrary1
  {
      /// &lt;summary&gt;
      /// Interaction logic for UserControl1.xaml
      /// &lt;/summary&gt;
      public partial class UserControl1 : UserControl
      {
          public UserControl1()
          {
              InitializeComponent();
          }
      }
  }
  </code></pre>
  
  <p>Incident_Request_Form.xaml</p>
  
  <pre><code>&lt;UserControl x:Class="WpfControlLibrary1.UserControl1"
               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" 
               mc:Ignorable="d" 
               d:DesignHeight="1000" d:DesignWidth="1024" Background="White"&gt;
      &lt;Grid x:Name="Background_Grid" Width="1024" Height="1000" Background="White"&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="0*"/&gt;
              &lt;RowDefinition/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="144" Grid.RowSpan="2" Stroke="Black" VerticalAlignment="Top" Width="1024" StrokeThickness="5"/&gt;
          &lt;Image HorizontalAlignment="Left" Height="134" Grid.RowSpan="2" VerticalAlignment="Top" Width="560" Source="logo.png" Margin="10,10,0,0"/&gt;
          &lt;TabControl HorizontalAlignment="Left" Height="826" Margin="524,164,0,0" Grid.RowSpan="2" VerticalAlignment="Top" Width="490"&gt;
              &lt;TabItem x:Name="Detail_Tab" Header="Incident Details" Cursor="Hand"&gt;
                  &lt;Grid Background="#FFE8F4F5" Margin="10,6,0,5.6"&gt;
                      &lt;Rectangle x:Name="Assignment_Box_Copy1" Fill="#FF8FCBF7" HorizontalAlignment="Left" Height="40" Stroke="Black" VerticalAlignment="Top" Width="470" StrokeThickness="0"/&gt;
                      &lt;Label x:Name="Incident_Detail_Label" Content="Incident Detail" HorizontalAlignment="Left" Height="41" VerticalAlignment="Top" Width="355" Cursor="None" FontSize="24" FontWeight="Bold" FontFamily="Microsoft YaHei UI"/&gt;
                      &lt;Label x:Name="Category_Label" Content="Category:" HorizontalAlignment="Left" Margin="0,40,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Area_Label" Content="Area:" HorizontalAlignment="Left" Margin="0,66,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Subarea_Label" Content="Sub-Area:" HorizontalAlignment="Left" Margin="0,92,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Impact_Label" Content="Impact" HorizontalAlignment="Left" Margin="0,137,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Urgency_Label" Content="Urgency" HorizontalAlignment="Left" Margin="0,163,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Priority_Label" Content="Priority:" HorizontalAlignment="Left" Margin="0,189,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Service_Contract_Label" Content="Service Contract:" HorizontalAlignment="Left" Margin="0,235,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="SLA_Target_Date_Label" Content="SLA Target Date:" HorizontalAlignment="Left" Margin="0,266,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Alert_Status_Label" Content="Alert Status:" HorizontalAlignment="Left" Margin="0,319,0,0" VerticalAlignment="Top"/&gt;
                      &lt;CheckBox x:Name="KB_Candidate_Checkbox" Content="Candiate for Knowledge DB" HorizontalAlignment="Left" Margin="10,390,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Hours_Worked_Label" Content="Hours Worked:" HorizontalAlignment="Left" Margin="0,411,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Closure_Code_Label" Content="Closure Code:" HorizontalAlignment="Left" Margin="0,436,0,0" VerticalAlignment="Top"/&gt;
                      &lt;Label x:Name="Solution_Label" Content="Solution:" HorizontalAlignment="Left" Margin="0,467,0,0" VerticalAlignment="Top"/&gt;
                      &lt;CheckBox x:Name="PM_Candidate_Checkbox" Content="Candidate for Problem Management" HorizontalAlignment="Left" Margin="192,390,0,0" VerticalAlignment="Top"/&gt;
                  &lt;/Grid&gt;
              &lt;/TabItem&gt;
              &lt;TabItem x:Name="Activities_Tab" Header="Activities" Cursor="Hand"&gt;
                  &lt;Grid Background="#FFE8F4F5"&gt;
                      &lt;Rectangle x:Name="Assignment_Box_Copy3" Fill="#FF8FCBF7" HorizontalAlignment="Left" Height="40" Stroke="Black" VerticalAlignment="Top" Width="470" StrokeThickness="0" Margin="10,10,0,0"/&gt;
                      &lt;Label x:Name="Activities_Label_Copy" Content="Activities" HorizontalAlignment="Left" Height="41" VerticalAlignment="Top" Width="355" Cursor="None" FontSize="24" FontWeight="Bold" FontFamily="Microsoft YaHei UI" Margin="10,10,0,0"/&gt;
                      &lt;TabControl HorizontalAlignment="Left" Height="728" Margin="10,56,0,0" VerticalAlignment="Top" Width="460"&gt;
                          &lt;TabItem x:Name="Update_Tab" Header="Update"&gt;
                              &lt;Grid x:Name="Update_Tab_Grid" Background="#FFE5E5E5"&gt;
                                  &lt;Label x:Name="Type_Label" Content="Type:" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" Width="45" FontFamily="Microsoft JhengHei UI" Margin="10,10,0,0"/&gt;
                                  &lt;CheckBox x:Name="Visible_2_Customers_Checkbox" Content="Visible To Customer?" HorizontalAlignment="Left" Margin="308,14,0,0" VerticalAlignment="Top"/&gt;
                                  &lt;Label x:Name="Update_Label" Content="Update:" HorizontalAlignment="Left" Margin="10,39,0,0" VerticalAlignment="Top"/&gt;
                                  &lt;TextBox x:Name="The_Update_TextBox" HorizontalAlignment="Left" Height="616" Margin="10,70,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="431"/&gt;
                              &lt;/Grid&gt;
                          &lt;/TabItem&gt;
                          &lt;TabItem x:Name="Journal_Updates_Tab" Header="Journal Updates"&gt;
                              &lt;Grid x:Name="Journal_Updates_Tab_Grid" Background="#FFE5E5E5"&gt;
                                  &lt;TextBlock x:Name="Journal_Update_Textblock" HorizontalAlignment="Left" Height="676" Margin="10,10,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="431"/&gt;
                              &lt;/Grid&gt;
                          &lt;/TabItem&gt;
                          &lt;TabItem x:Name="Historic_Activities_Tab" Header="Historic Activities" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top"&gt;
                              &lt;Grid x:Name="Historic_Activities_Tab_Grid" Background="#FFE5E5E5"&gt;
                                  &lt;Label x:Name="Filter_Label" Content="Filter By Activity Type:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="28"/&gt;
                                  &lt;Button x:Name="Filter_Button" Content="Filter" HorizontalAlignment="Left" Height="29" Margin="10,76,0,0" VerticalAlignment="Top" Width="125"/&gt;
                              &lt;/Grid&gt;
                          &lt;/TabItem&gt;
                      &lt;/TabControl&gt;
                  &lt;/Grid&gt;
              &lt;/TabItem&gt;
              &lt;TabItem x:Name="Related_Tab" Header="Related Records" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Cursor="Hand"&gt;
                  &lt;Grid x:Name="Tabs" Background="#FFE5E5E5"&gt;
                      &lt;TabControl HorizontalAlignment="Left" Height="774" Margin="10,10,0,0" VerticalAlignment="Top" Width="460"&gt;
                          &lt;TabItem x:Name="Interactions_Tab" Header="Interactions"&gt;
                              &lt;Grid Background="#FFE5E5E5"/&gt;
                          &lt;/TabItem&gt;
                          &lt;TabItem x:Name="Incidents_Tab" Header="Incidents"&gt;
                              &lt;Grid Background="#FFE5E5E5"/&gt;
                          &lt;/TabItem&gt;
                          &lt;TabItem x:Name="Changes_Tab" Header="Changes" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top"&gt;
                              &lt;Grid Background="#FFE5E5E5"/&gt;
                          &lt;/TabItem&gt;
                          &lt;TabItem x:Name="Quotes_Tab" Header="Quotes" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="57.6"&gt;
                              &lt;Grid Background="#FFE5E5E5"/&gt;
                          &lt;/TabItem&gt;
                          &lt;TabItem x:Name="Problems_Tab" Header="Problems" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top"&gt;
                              &lt;Grid Background="#FFE5E5E5"/&gt;
                          &lt;/TabItem&gt;
                          &lt;TabItem x:Name="RMA_Tab" Header="RMA" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="57.6"&gt;
                              &lt;Grid Background="#FFE5E5E5"/&gt;
                          &lt;/TabItem&gt;
                      &lt;/TabControl&gt;
                  &lt;/Grid&gt;
              &lt;/TabItem&gt;
              &lt;TabItem x:Name="History_Tab" Header="History" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="57.6"&gt;
                  &lt;Grid x:Name="Tab_Grid" Background="#FFE5E5E5" Cursor="Arrow"/&gt;
              &lt;/TabItem&gt;
              &lt;TabItem x:Name="Attachment_Tab" Header="Attachments" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Cursor="Hand"&gt;
                  &lt;Grid Background="#FFE5E5E5"/&gt;
              &lt;/TabItem&gt;
              &lt;TabItem x:Name="Alerts_Tab" Header="Alerts" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="57.6"&gt;
                  &lt;Grid Background="#FFE5E5E5"/&gt;
              &lt;/TabItem&gt;
          &lt;/TabControl&gt;
          &lt;Rectangle x:Name="Assignment_Box_Copy2" Fill="#FF8FCBF7" HorizontalAlignment="Left" Height="40" Margin="10,160,0,0" Stroke="Black" VerticalAlignment="Top" Width="499" StrokeThickness="0" Grid.RowSpan="2"/&gt;
          &lt;Label x:Name="Heading" Content="Incident Information" HorizontalAlignment="Left" Height="41" Margin="10,164,0,0" Grid.RowSpan="2" VerticalAlignment="Top" Width="355" Cursor="None" FontSize="24" FontWeight="Bold" FontFamily="Microsoft YaHei UI"/&gt;
          &lt;Grid x:Name="General_Information_Grid" HorizontalAlignment="Left" Height="785" Margin="10,205,0,0" Grid.RowSpan="2" VerticalAlignment="Top" Width="509"&gt;
              &lt;Label x:Name="Incident_ID" Content="Incident ID:" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" Width="75" FontFamily="Microsoft JhengHei UI"/&gt;
              &lt;Label x:Name="Status_Label" Content="Status:" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" Width="75" FontFamily="Microsoft JhengHei UI" Margin="0,29,0,0"/&gt;
              &lt;Label x:Name="Status_Reasoning_Label" Content="Status Reasoning:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,53,0,0"/&gt;
              &lt;Rectangle x:Name="Assignment_Box" Fill="#FF8FCBF7" HorizontalAlignment="Left" Height="40" Margin="0,84,0,0" Stroke="Black" VerticalAlignment="Top" Width="499" StrokeThickness="0"/&gt;
              &lt;Label x:Name="Assignment_Label" Content="Assignment" Margin="0,84,223,0" Height="38" Width="137" FontSize="22" FontWeight="Bold" VerticalAlignment="Top" HorizontalAlignment="Left"/&gt;
              &lt;Label x:Name="Assignment_Group_Label" Content="Assignment Group:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,124,0,0"/&gt;
  
              &lt;Label x:Name="Assignee_Label" Content="Assignee:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,150,0,0"/&gt;
              &lt;Label x:Name="Vendor_Label" Content="Vendor:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,176,0,0"/&gt;
              &lt;Label x:Name="Reference_Number_Label" Content="Vendor Reference Number:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,202,0,0"/&gt;
              &lt;Rectangle x:Name="Assignment_Box_Copy" Fill="#FF8FCBF7" HorizontalAlignment="Left" Height="35" Margin="0,233,0,0" Stroke="Black" VerticalAlignment="Top" Width="499" StrokeThickness="0"/&gt;
              &lt;Label x:Name="Afected_Items" Content="Affected Items" Margin="0,230,0,0" Height="38" FontSize="22" FontWeight="Bold" VerticalAlignment="Top" HorizontalAlignment="Left" Width="165"/&gt;
              &lt;Label x:Name="Status_Label_Copy" Content="Status:" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" Width="75" FontFamily="Microsoft JhengHei UI" Margin="0,29,0,0"/&gt;
              &lt;Label x:Name="Service_Label" Content="Service:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,277,0,0"/&gt;
              &lt;Label x:Name="Affected_CI_Label" Content="Affected CI:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,308,0,0"/&gt;
              &lt;CheckBox x:Name="Critical_CI_Checkbox" Content="Critical CI" HorizontalAlignment="Left" Margin="2,346,0,0" VerticalAlignment="Top"/&gt;
              &lt;CheckBox x:Name="Pending_Change_Checkbox" Content="Pending Change" HorizontalAlignment="Left" Margin="156,346,0,0" VerticalAlignment="Top"/&gt;
              &lt;CheckBox x:Name="CI_Operational_Checkbox" Content="CI is Operational (No Outage)" HorizontalAlignment="Left" Margin="326,346,0,0" VerticalAlignment="Top"/&gt;
              &lt;Label x:Name="Outage_Start_Label" Content="Outage Start:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,367,0,0"/&gt;
              &lt;Label x:Name="Outage_End_Label" Content="Outage End:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,393,0,0"/&gt;
              &lt;Label x:Name="Location_Label" Content="Location:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,424,0,0"/&gt;
              &lt;Label x:Name="Title_Label" Content="Title:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,455,0,0"/&gt;
              &lt;Label x:Name="Description_Label" Content="Description:" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="None" FontWeight="Bold" FontFamily="Microsoft JhengHei UI" Margin="0,521,0,0"/&gt;
              &lt;TextBox x:Name="Vendor_Reference_Textbox" HorizontalAlignment="Left" Height="26" Margin="199,202,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="300" ToolTip="Enter Vendor Reference # Here"/&gt;
              &lt;TextBox x:Name="Title_Textbox" HorizontalAlignment="Left" Height="26" Margin="10,486,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="489" ToolTip="Enter Vendor Reference # Here"/&gt;
              &lt;TextBox x:Name="Description_Textbox" HorizontalAlignment="Left" Height="228" Margin="10,547,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="489" ToolTip="Enter Vendor Reference # Here"/&gt;
          &lt;/Grid&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>