This question is locked. New answers and comments are not allowed.
Hi All,
We are using the grid view and we are dynamically generating columns based on some metadata. In the code I specify the DisplayMemberBinding and when the grid renders the columns display the correct data. Now I need to extend the UI so that when the meta data says a column is of a specific type I need to apply a different cell template. So I have code that does this.
column.CellTemplate = ResolveTemplate()
This returns a specifc DataTemplate that I have defined and is shown below.
<DataTemplate x:Key="DefaultTextCellTemplate">
<Grid Presentation:SharedResourceDictionary.UsesImplicit="True">
<TextBlock Text="{Binding}"
Foreground="Blue" />
</Grid>
</DataTemplate>
The problem I have is that the binding is the row data not the DisplayMemberBinding I have specified. I need to get the value for the column the same way the default cell style does but I cannot figure out how you guys have done this. A look in the styles didn't answer it.
Could you tell me if this is possible and how I may go about solving this problem using the GridView.
Many Thanks,
Dave Hanson
We are using the grid view and we are dynamically generating columns based on some metadata. In the code I specify the DisplayMemberBinding and when the grid renders the columns display the correct data. Now I need to extend the UI so that when the meta data says a column is of a specific type I need to apply a different cell template. So I have code that does this.
column.CellTemplate = ResolveTemplate()
This returns a specifc DataTemplate that I have defined and is shown below.
<DataTemplate x:Key="DefaultTextCellTemplate">
<Grid Presentation:SharedResourceDictionary.UsesImplicit="True">
<TextBlock Text="{Binding}"
Foreground="Blue" />
</Grid>
</DataTemplate>
The problem I have is that the binding is the row data not the DisplayMemberBinding I have specified. I need to get the value for the column the same way the default cell style does but I cannot figure out how you guys have done this. A look in the styles didn't answer it.
Could you tell me if this is possible and how I may go about solving this problem using the GridView.
Many Thanks,
Dave Hanson