This is a migrated thread and some comments may be shown as answers.

Databound ToolTip for dynamically created GridViewComboBoxColumn

1 Answer 165 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Arpit
Top achievements
Rank 1
Arpit asked on 06 Jun 2013, 12:24 PM
Hi,

I am creating GridViewComboBoxColumn dynamically in code behind and want to bind ToolTip of the cells in this column to some property as below

var colLabor = new GridViewComboBoxColumn();
var tTemp = new DataTemplate() { DataType = typeof(Labor) };
 
FrameworkElementFactory factoryTextBlock = new FrameworkElementFactory(typeof(TextBox)) { Name = "factoryTextBlock" };
//factoryTextBlock.SetBinding(TextBlock.TextProperty, new Binding("ResourceTypeId"));
factoryTextBlock.SetValue(TextBox.TextProperty, "OK BYE");
factoryTextBlock.SetValue(TextBox.FontSizeProperty, 10.0d);
factoryTextBlock.SetValue(TextBox.WidthProperty, 100.0d);
tTemp.VisualTree = factoryTextBlock;
colLabor.ToolTipTemplate = tTemp;

But couldn't get it working.

But if I do its equivalent (I believe so) in XAML as described here, it works. Unfortunately the column is created on runtime so I can't go with XAML option.

Any ideas/suggestions?

Arpit

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 07 Jun 2013, 01:50 PM
Hello,

 I guess that you should seal the template before assigning it. I have prepared a similar sample project and it is working well on my side. It is attached for your reference.

Regards,
Ivan Ivanov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Arpit
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or