Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit setting a tooltip on a DataGridTextColumn or instead using DataGridTemplateColumn but sorting doesn't work
5 replies. Latest Post by lawazia on June 25, 2009.
(0)
silverbyte
Participant
1338 points
405 Posts
11-12-2008 6:03 PM |
Hello,
I have a DataGrid control with a column on which I want the sorting to work and also have a tooltip displayed on the cell.
I was unable to set ToolTipService.ToolTip property on a DataGridTextColumn either directly or by using DataGridTextColumn.ElementStyle and then on TextBox.
I succeeded though to set it on a DataGridTemplateColumn but the sorting doesn't work.
Can you please tell me the right way to do this ?
Thank you.
11-12-2008 6:11 PM |
Found the problem.
I need to set the SortMemberPath for any column not derived from DataGridBoundColumn,
But I still wonder how would one can set tool tips for a DataGridTextColumn
Amanda W...
All-Star
17241 points
1,466 Posts
11-15-2008 3:02 AM |
Hi,
silverbyte:But I still wonder how would one can set tool tips for a DataGridTextColumn
We have a test on our labs, if we set the Tooltip for the DataGridTextColumn, we got the error "Unknown attribute ToolTipService.ToolTip on element DataGridTextColumn". It is weird.
But if you want to add the tooltip for the DataGridColumn, you can try to use the DataGrid's DataGridTemplateColumn, and place a textBox in the template and set the TextBox's toolTip.
for example:
<data:DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <TextBox Text="{Binding Lastname}" ToolTipService.ToolTip="The LastName" /> </DataTemplate></data:DataGridTemplateColumn.CellEditingTemplate>
11-15-2008 8:14 AM |
Yes, the same behaviour here, in the end I did replace it with a DataGridTemplateColumn but it's a pitty we need to do this just for the tooltip.
I guess this is a bug then ? Is there any complete list with all known bugs in DataGrid or (better) in Silverlight 2 ?
Do you know if there is also a known problem with binding the Foreground property of DataGridTextColumn and using IValueConverter ?
In order not to discuss the same problem here please follow my thread regarding this: http://silverlight.net/forums/t/49800.aspx
11-18-2008 5:29 AM |
silverbyte:I guess this is a bug then ? Is there any complete list with all known bugs in DataGrid or (better) in Silverlight 2 ?
lawazia
Member
126 points
58 Posts
06-25-2009 4:38 AM |
You can create a custom datagrid column which supports tooltip as ahown here : public class DataGridTooltipColumn : DataGridTemplateColumn {
public
}
<
<local:DataGridTooltipColumn Header="ExpiryDate" BindingExpression="Binding Converter={StaticResource DateConverter} "/>