I have been searching the message boards for a technique for adding underline to specific cells in the xamdatagrid. Haven't found a good solution yet. Here is an example of what I am doing:
CellValuePresenter cvp;
foreach (Cell c in dr.Cells) { cvp = CellValuePresenter.FromCell(c); if (cvp != null) { cvp.FontWeight = FontWeights.Normal; cvp.FontStyle = FontStyles.Normal; cvp.Foreground = Brushes.Black; //need underline }
Any advice?
Hello,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into it and I can suggest you set the CellClickAction to EnterEditModeIfAllowed. Here you can see all available values:
http://help.infragistics.com/Help/NetAdvantage/WPF/2011.2/CLR4.0/html/InfragisticsWPF4.DataPresenter.v11.2~Infragistics.Windows.DataPresenter.CellClickAction.html
Looks like the grid is also using PreviewMouseLeftButtonDown, and a FieldSettings CellClickAction="SelectRecord". I suspect that these are causing problems for me - not sure how to work around them.
I see that your solution works perfectly. I tried implementing these concepts in my project, but I do not get the same results. The cells do not go directly into xamcomboeditor mode when they are clicked the first time. There seems to be something else in the grid setup that is causing this - I am using a grid control that is defined in another area of this much larger project. So I will need to research that.
I have modified the sample you have sent me, so now it works as you want. Bascially instead of SimpleTextBlock I look for TextBlock, because this is the element used in XamComboEditor. Also I used EditModeEnded instead of EditModeEnding event because the ending one is fired to early.
Hope this helps you.
see attachment for a sample project that shows the behavior (losing underline)