Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
DataBinding to a TemplateColumn to a complex Type
posted

 

Hi,

I am using Xamwebgrid and my gid has many templatecolumns. all templatecolumns are bound

to a complex type.  My cells are not displying the values from the complex type WeekAvailsSumamry

 

 

.Please see attached file for code sample.

 

 

vs

 

Parents
  • 100
    posted

     

    Hi,

     

    I guess I have found the solution but not sure whether it is really the right way to do it.

     

    After realizing the fact that the row data is the datacontext for the templatecomlumn. I created Many Data Templates basically one for each column the use the following syntax in binding

     

    MycomplextColumnProperty.Value

     

    Column #1

    <DataTemplate x:Key="W1AvailsCell">

    <TextBlock Margin="2" Grid.Row="0" Grid.Column="1" Text="{Binding W1.CapacityValue}"/>

    </DataTemplate>

     

    Column#2

    <DataTemplate x:Key="W2AvailsCell">

    <TextBlock Margin="2" Grid.Row="0" Grid.Column="1" Text="{Binding W2.CapacityValue}"/>

     </DataTemplate>

     

    But I don’t like th fact that I can’t create a genreic datatemplate and use it for all colums that are of same complex type.

     

    We are currently prototyping the project and at the same time lookig for all 3rd part grid control for Silverlight

     

    Is there any better or correct way to achive the same?

     

    are there any plans for providing each cell it’s own data context so that in case of complex type generic databinding can be used.

     

    VS

Reply Children