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 ");
"xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' ");
"xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> ");
" <TextBlock x:Name=\"txtNormal\" FontWeight=\"Bold\" TextDecorations=\"Underline\" Text=\"" + tbItem.Description.ToString() + "\" Margin=\"11,0,11,0\" HorizontalAlignment=\"Left\"/>");
" </DataTemplate>");
e.Cell.Control.ContentTemplate = (
DataTemplate)XamlReader.Load(CellTemp.ToString());
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.
Hello Pragati,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
I have created a sample project for you with a conditional formatting without using the built-in functionality that we provide in 11.2. I used a TemplateColumn and bind the TextBlock’s Text inside it using Converter. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Hello Stefan,
Thanks for your reply. As I've mentioned earlier, I'm using the dll - Infragistics.Silverlight.XamWebGrid.v9.2 with version - 9.2.20092.1007. I checked with my code, but its not giving me the options like .ConditionalFormattingSettings . (The version of your dll is 11.2) My code is like -
<
UserControl x:Class="IndigoWeb.modules.Company.ucUserModels"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:igGrid="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.XamWebGrid.v9.2"
<Grid Margin="0,0,0,0">
igGrid:XamWebGrid x:Name="igUserModels" Margin="0" Height="180" Width="410">
</igGrid:XamWebGrid>
Actually, for some reasons I want to use the dll of version 9.2 only.
Thanks,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.