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
665
XamWebGrid cellcontrol text underlined.
posted

Hello,

I'm using the dll - Infragistics.Silverlight.XamWebGrid.v9.2, Visual Studio 10, SL 4

I need to underline the text in a perticular cell of a XamWebGrid. I'm trying to set it in event - igGrid_CellControlAttached - as I want to apply it for a specific cell depending upon the condition.
I used the template -

 <ControlTemplate x:Name="UserDefinedChainNameUnderline">

<Grid>

<TextBlock Text="{Binding Description}" TextDecorations="Underline" Margin="0" HorizontalAlignment="Right"/>

</Grid>

</ControlTemplate>

and in code apply it like -

e.Cell.Control.Template = this.Resources["UserDefinedChainNameUnderline"] as ControlTemplate;

e.Cell.Control.ApplyTemplate();

But, I'm getting it blank.

Another way I tried is like this -
Style -

 

 

 

 

 

 

<Style x:Key="IGNormalCellStyle" TargetType="igGrid:CellControl">

<Setter Property="FontSize" Value="11"></Setter>

 

 

 

 

<Setter Property="Padding" Value="0,0,0,0"/>

 

 

 

 

 

 

 

 

</Style>

Code -

private void igGrid_CellControlAttached(object sender, CellControlAttachedEventArgs e)

{

 

 

StringBuilder CellTemp = new StringBuilder();

CellTemp.Append(

 

"<DataTemplate ");

CellTemp.Append(

 

"xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' ");

CellTemp.Append(

 

"xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> ");

CellTemp.Append(

 

" <TextBlock x:Name=\"txtNormal\" FontWeight=\"Bold\" TextDecorations=\"Underline\" Text=\"" + tbItem.Description.ToString() + "\" Margin=\"11,0,11,0\" HorizontalAlignment=\"Left\"/>");

CellTemp.Append(

 

" </DataTemplate>");

e.Cell.Control.ContentTemplate = (

 

DataTemplate)XamlReader.Load(CellTemp.ToString());

e.Cell.Control.ApplyTemplate();

e.Cell.Style = app.dictionary[

 

"IGNormalCellStyle"] as Style;

}

With this code, I get the cell content underlined, but while scrolling, the style gets applied to non required cells as well & as instead of binding, I'm assigning the text in Template, the data in the cells get changed giving wrong result.


Please help, if anyone has got the solution.

Thanks,

Pragati.