Hi,
I am trying out the Infragistics WPF controls (version 9.1) and am facing a little problem. In my XamDataGrid, I want to use a Field that holds a TextBlock and that TextBlock's Text property needs to be bound to a property which is being used as the DataSource of the XamDataGrid. Here's the code-
<igDP:XamDataGrid x:Name="xdgAuditGrid" Theme="Office2k7Black" BorderBrush="Silver" BorderThickness="6" Padding="10"> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Settings> <igDP:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="False" AllowDelete="False"/> </igDP:FieldLayout.Settings> <igDP:FieldLayout.Fields> <igDP:Field x:Name="dgcRevisionStamp" Name="RevisionStamp" Label="Occured On" /> <igDP:Field x:Name="dgcAction" Name="Actions" Label="Action" Converter="{StaticResource ActionConverter}"/> <igDP:Field x:Name="dgcUserName" Name="UserName" Label="User Name" /> <igDP:Field x:Name="dgcTableName" Name="TableName" Label="Table Name" /> <igDP:UnboundField x:Name="dgcInitData" Label="Initial Data"> <igDP:Field.Settings> <igDP:FieldSettings> <igDP:FieldSettings.CellValuePresenterStyle> <Style TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <TextBlock x:Name="txbOldData" Text="{Binding OldData}" Loaded="TxbOldData_Loaded" ToolTipService.ShowDuration="20000"/> </ControlTemplate> </Setter.Value> </Setter> </Style> </igDP:FieldSettings.CellValuePresenterStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:UnboundField> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings AllowEdit="False"/> </igDP:XamDataGrid.FieldSettings> </igDP:XamDataGrid>
The code marked in bold, should bind the text property of the control "txbOldData". But after the datagrid is loaded, all other properties are bound, except for the "Initial Data" column.
It'd be of great help if you could show me what I am doing wrong here?
Thanks a bunch!!
Hello,
You should not retemplate the CellValuePresenter. If you want to bind to a property, you should use the BindingPath property of the Unbound Field
<UnboundField ... BindingPath="oldData"...
Thanks a lot for the quick reply. But I need that TextBlock to be bound to the "OldData" so that in the TextBlock's Loaded event I can add a ToolTip to that TextBlock. This is required to present the data in property "OldData" in a different way.
Basically, "OldData" is a string that has values read from an xml file. I need to show the values from that xml file in the tooltip so that it is well understood by the end-user.
So, what do I have to do, if I have to retemplate the cell with a textblock and bind the text property of that textblock? And, I know I'm asking for a lot, but is there any other way I can achieve this?
Thanks again for your support....