Hi,
I am using Silverlight 4 in C# with Infragistics' web client package. What I am trying to do is to create a control template for a cell's style in a XamGrid control. Inside the control template, there is a TextBlock control which is used to display the cell's value.
I have successfully adding a TextBlock in the control template. However, when I was trying to assign the cell's value to the Text property of the TextBlock control by setting Text={TemplateBinding Cell.Value}, I got an error saying Value was nout found. If I set Text={TemplateBinding Content}, there was nothing displayed in the TextBlock control.
I am wondering how to bind the Text property of the TextBlock control to the cell's value.
Thank you for your response.
Best,
Frank
Hello Steve,
Thank you for getting back to me. Yes, I was able to achieve what I wanted based on your suggestion!
Excellent!
Hi Frank,
You wouldn't create a separate ItemTemplate, instead you'd have one ItemTemplate, and use a ValueConverter and a Binding to the TextDecorations property of the TextBlock
So something like:
<TextBlock TextDecorations={Binding Converter={StaticResource yourConverter}}/>
Then in your converter, the value you'll receive will be your data object, which you can validate against, and return the property TextDecoration value.
Hope this helps,
-SteveZ
Is it possible to create an item template and apply it to a signle cell of a unbound column?
The goal is to have values in some cells underlined, instead of having all of them underlined.
Thank you.
I tried your solution and it works perfectly for me!!!
Thank you so much!!!
You can use the ItemTemplate property of the UnboundColumn.
The DataContext is of type: UnboundDataContext. You can read more about the ItemTemplate and how to use the DataContext in the following help article:
http://help.infragistics.com/NetAdvantage/Silverlight/2010.2/CLR4.0/?page=xamGrid_Unbound_Column.html
But basically, you'll want to have a DataTemplate that looks like:<DataTemplate> <TextBlock Text={Binding Value} Style="{StaticResource YourTBStyle}" /></DataTemplate>