title: Change user control appearance based on state
body: <p>I have a user control that consists of four overlapping items: 2 rectangles, an ellipse and a lable</p>
  
  <pre><code>&lt;UserControl x:Class="UserControl"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="50.1" Height="45.424" Background="Transparent" FontSize="24"&gt;
  &lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="3.303*" /&gt;
          &lt;RowDefinition Height="40*" /&gt;
          &lt;RowDefinition Height="2.121*" /&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="5.344*" /&gt;
          &lt;ColumnDefinition Width="40.075*" /&gt;
          &lt;ColumnDefinition Width="4.663*" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Rectangle Name="Rectangle1" RadiusX="5" RadiusY="5" Fill="DarkGray" Grid.ColumnSpan="3" Grid.RowSpan="3" /&gt;
      &lt;Ellipse Name="ellipse1" Fill="{Binding State}" Margin="0.016,0.001,4.663,0" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Stroke="Black" IsEnabled="True" Panel.ZIndex="2" /&gt;
      &lt;Label Name="lblNumber" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" FontWeight="Bold" FontSize="24" Grid.Column="1" Grid.Row="1" Padding="0" Panel.ZIndex="3"&gt;9&lt;/Label&gt;
      &lt;Rectangle Grid.Column="1" Grid.Row="1" Margin="0.091,0,4.663,0" Fill="Blue" Name="rectangle2" Stroke="Black" Grid.ColumnSpan="2" Panel.ZIndex="1" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is my business object that I want to control the state of my user control:</p>
  
  <pre><code>Imports System.Data
  Imports System.ComponentModel
  
  Public Class BusinessObject
      Implements INotifyPropertyChanged
      Public logger As log4net.ILog
  
      Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
  
      Private _state As States
      Public Enum States
          State1
          State2
          State3
      End Enum
  
      Public Property State() As States
          Get
              Return _state
          End Get
          Set(ByVal value As States)
              If (value &lt;&gt; _state) Then
                  _state = value
                  RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("State"))
              End If
  
          End Set
      End Property
  
      Protected Sub OnPropertyChanged(ByVal name As String)
          RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(name))
      End Sub
  </code></pre>
  
  <p>I want to be able to change the state of a business object in the code behind and have that change the colors of multiple shapes in my usercontrol. I'm not sure about how to do the binding. I set the datacontext of the user control in the code behind but not sure if that's right. I'm new to WPF and programming in general and I'm stuck on where to go from here. Any recommendations would be greatly appreciated!!</p>