WPF: How to get Binding.Converter
Posted
by Nike
on Stack Overflow
See other posts from Stack Overflow
or by Nike
Published on 2010-03-31T21:50:28Z
Indexed on
2010/03/31
22:13 UTC
Read the original article
Hit count: 341
I create DataGrid Columns with Binding (where i is a Int value):
dataGrid.Columns.Add(new DataGridTextColumn
{
Header = i.ToString(),
Binding = CreateBinding(i),
});
private Binding CreateBinding(int num)
{
Binding bind = new Binding(string.Format("[{0}]", num));
bind.Converter = new CellValueConverter();
return bind;
}
In the CreateBinding method I have an access to bind.Converter property.
I need to call Converter.Convert() method in some handler, but there is no Converter property when I try to access it:
(dataGrid.Columns[clm] as DataGridTextColumn).Binding."no Converter property!"
How can I get my CellValueConverter which was created for particular Column?
© Stack Overflow or respective owner