Hi,
How would I go about displaying rich text in the XamDataGrid? Nothing fancy, but I need to highlight words that match a search (the grid is used to display the results.) Whether it's a different color, bold or underline has yet to be determined, but it most likely won't be anything fancier.
Thanks,Michel
Hi, I am quite new to infragistics and I am not sure how to go about creating the BindableTextBlock and MultilingualStringConverter. Are these available somewhere please?
Thanks,
Cristina
Alex,
I am providing a sample (just a sample code) to reproduse the behaviour here:
Please include the neccessary dlls.
My xaml page:
<
="WpfApplication2.Window1"
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
="http://schemas.microsoft.com/winfx/2006/xaml"
="http://infragistics.com/DataPresenter"
="clr-namespace:Infragistics.Windows.DataPresenter.Events;assembly=Infragistics3.Wpf.DataPresenter.v9.1"
="clr-namespace:WpfApplication2"
="300">
="Grid1">
>
=Table1}">
}">
="Green"/>
="Red"/>
="Template">
=TwoWay}"/>
My code bihind:
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Windows;
System.Windows.Controls;
System.Windows.Data;
System.Windows.Documents;
System.Windows.Input;
System.Windows.Media;
System.Windows.Media.Imaging;
System.Windows.Navigation;
System.Windows.Shapes;
System.Data;
Infragistics.Windows.DataPresenter;
WpfApplication2;
namespace
WpfApplication2
{
<summary>
Interaction logic for Window1.xaml
</summary>
Window
();
Window1()
InitializeComponent();
fillGrid();
);
}
e)
.TestColor.FieldLayouts[0].Fields)
))
field.Settings.CellValuePresenterStyleSelector =
.Choose.SelectedIndex == 1)
;
else
fillGrid()
dcName.ColumnName =
dcAddress.ColumnName =
dcColor.ColumnName =
datasource.Columns.Add(dcName);
datasource.Columns.Add(dcAddress);
datasource.Columns.Add(dcColor);
dr1 = datasource.NewRow();
dr2 = datasource.NewRow();
dr1[
datasource.Rows.Add(dr1);
dr2[
datasource.Rows.Add(dr2);
ds.Tables.Add(datasource);
.TestColor.DataContext = ds;
.TestColor.DataSource = ds.Tables[0].DefaultView;
StyleSelector
MatchResultStyleSelector()
container)
st;
.Empty;
matchResultColumnName)
.matchRuleResultColumn = matchResultColumnName.ToUpper();
Infragistics.Windows.DataPresenter.
)(container)).Record;
)
dr.FieldLayout.Fields)
.matchRuleResultColumn)
isFound =
cellValue = dr.Cells[2].Value.ToString().ToUpper();
style = -1;
style =
)(container)).Field.Name.ToUpper());
(style == 0)
(style == 1)
.SelectStyle(item, container);
cellName)
try
.ToString(content);
//Find number of line
(makeLines.Length > 0)
i = 0; i < makeLines.Length; i++)
//Find number of Rules
(cols.Length > 1)
//Find each rule status (pass or fail)
(result.Length > 1)
.ToString(result[0]);
//Get the attribute
(attributeList.Length > 0)
h = 0; h < attributeList.Length; h++)
(cellName.ToUpper().Equals(attributeList[0].ToUpper()))
style = 1;
style = 0;
ex)
ex;
style;
Label
));
CellName
get
.GetValue(CellNameProperty));
set
CellValue
.GetValue(CellValueProperty));
RecsBackcolour()
(RecsBackcolour_Loaded);
FormatBackGround(
.ToString(CellName));
.ToString(CellValue);
//base.Background = new B;
//base.Background = RecsResourceManager.GetBrushByName("Fail_Colour");
RecsMultiColourLabel()
(MultiColourLabel_Loaded);
.Content);
Write logic to format the text
<param name="text"></param>
<returns></returns>
text)
sp.Orientation =
.Vertical;
.ToString(text);
(result.Length > 0)
lb =
lb.Content = cols[0] +
+ rst;
lb.Foreground = txnPanel.Grid1.Resources[
sp.Children.Add(lb);
// RaiseChangeCellBackColorEvent();
sp;
// Provide CLR accessors for the event
ChangeCellBackColor
); }
// This method raises the Tap event
RaiseChangeCellBackColorEvent()
.ChangeCellBackColorEvent);
RaiseEvent(newEventArgs);
----------------------------------
In the above code, i have a button, combo box and xamdatagrid.
During statu up of the screen, coloring is not applied in the Xamdatagrid
Combo box in 'Remove Filtering' mode, when i click the click button coloring will be applied. After coloring when i group the column then the coloring is disappeared with the content .
Combo box in 'Allow Filterting' mode, when i make the 'AllowRecordFiltering' to true. Then the content disappears.
If we see the filter values, we can see the underlying 'stack panel'.
thanks,
aziz
Aziz,
Do you have a sample that reproduces this issue?
Hi Alex,
I used the code(with changes) suggested to get different font color in a single cell based on cell value. But i have two problems.
1. when trying to sort or group any columns in the grid. The value gets disappeared.
2. When i try to filter that particular column to which i have applied the style to get different colors, i see the stack panel control as column value.
Any immediate suggestions to solve this problem is appreciated.
It doesn't seem to like negative padding (I get a runtime error.) CellMaxHeight seems to be doing the trick (close enough anyway.) However the user is allowed to change font size on the fly, so I'm thinking of calculating the value on the fly based on the font size, and binding CellMaxHeight to that value. That will hopefully give good enough results.