tags:

views:

51

answers:

0

Hello,

I have a custom class that inherits 'DataGridBoundColumn' that generates a custom control for me inside my gridview. Now I know I can assign static properties just fine, but my problem is when I try to assign binded properties. Below is an example of my background:

This works:

public property Background as Brush  
<Controls:DataGridTimeColumn Binding="{Binding field, Mode=TwoWay}" Background="red" />

Problem is if I try the following, I get an error saying i can not bind to a normal property:

<Controls:DataGridTimeColumn Binding="{Binding field, Mode=TwoWay}" Background="{Binding Path=active, Converter={StaticResource activeBackgroundConvertor}}" />

Now from exporing examples on a Custom DataTextboxColumn, I know how to allow binding to a property through the follow. The problem is, when I do this, it never seems to store the data:

Public Property Background() As Brush  
  Get  
    Return DirectCast(GetValue(BackgroundProperty), Brush)  
  End Get
  Set(ByVal value As Brush)
    SetValue(BackgroundProperty, value)
  End Set
End Property

Public Shared ReadOnly BackgroundProperty As DependencyProperty = DependencyProperty.Register("Background", GetType(Brush), GetType(DataGridBoundColumn), New UIPropertyMetadata(Brushes.Transparent))

When I try to reference me.Background, it is always null, even if I use:

<Controls:DataGridTimeColumn Binding="{Binding field, Mode=TwoWay}" Background="red" />

You can find a copy of my coding here: http://pastebin.com/h5F9DDRc

my overall goal is to be able to do:

<Controls:DataGridTimeColumn Binding="{Binding field, Mode=TwoWay}" Background="{Binding Path=active, Converter={StaticResource activeBackgroundConvertor}}" />