title: Binding R G B properties of color in wpf
body: <p>I have a custom class, "FavoriteColor" that has three properties, <strong>R</strong>, <strong>G</strong> and <strong>B</strong>. Now I want to draw a rectangle and fill it with these R, G and B values (using databinding). I tried the following snippet in my xaml, but gives me a compile time error.   </p>
  
  <pre><code>                &lt;Rectangle Width="10" Height="10" Grid.Column="4"&gt;
                      &lt;Rectangle.Fill&gt;
                          &lt;SolidColorBrush&gt;
                              &lt;SolidColorBrush.Color&gt;
                                  &lt;Color R="{Binding Path=R}" /&gt;
                                  &lt;Color G="{Binding Path=G}" /&gt;
                                  &lt;Color B="{Binding Path=B}" /&gt;
                              &lt;/SolidColorBrush.Color&gt;
                          &lt;/SolidColorBrush&gt;
                      &lt;/Rectangle.Fill&gt;
                  &lt;/Rectangle&gt;
  </code></pre>
  
  <p>It says that the properties R, G and B of Color class are not dependency properties. I know that you can bind data only to dependency properties, but in this case, how do I bind my R, G and B with the rectangle's fill color.   </p>
  
  <p><em>Is there any other way other than by declaring one more property of type color and then initializing it when R, G and B are set? Also why the R, G and B of the color class are not dependency properties?</em></p>