title: Converting a Hex String (from WPF TextBox) into byte
body: <p>I write small WPF application. In my app I have one field called <code>Seq</code> which is actually the byte data. </p>
  
  <p>So <code>Seq</code> field should get updated via <code>TextBox</code> of the WPF application. But Text string will be typed in Hex format without leading 0x.</p>
  
  <p>Basically I need to write down the algorithm to complete the set method of <code>Seq</code> to set only one byte of data.</p>
  
  <p>Object class which gets updated via text box:</p>
  
  <pre><code>public class WProtocol {
       private byte _seq
       public byte Seq {
           get {
               return _seq;
           }
           set {
               _seq = value;
           }
       }
   }
  </code></pre>
  
  <p><code>WFrameWindow.xaml.cs</code>:</p>
  
  <pre><code>public partial class WFrameWindow: Window {
      WProtocol m_WProtocol = new WProtocol();
      public WFrameWindow() {
          InitializeComponent();
          this.DataContext = m_WProtocol;
      }
  }
  </code></pre>
  
  <p>Snippet from <code>WFrameWindow.xaml</code> to show binding the of the source: </p>
  
  <pre><code>&lt;TextBox HorizontalAlignment="Left" Height="24" Margin="115,26,0,0" TextWrapping="Wrap" Text="{***Binding Seq,Mode=OneWayToSource , UpdateSourceTrigger=PropertyChanged***}" VerticalAlignment="Top" Width="99" FontSize="9" FontFamily="Arial"/&gt;
  </code></pre>