c# - Converters, sending a String and returning a int -


I have this converter that returns the number of the width of textbox according to the number of characters (Value value, type target type, object parameter, cultureinfo culture) {string}: {valueConversion (typef (string), typef (int)) public class textdown: g = (string) value; Return g.Length * 10; } Public Object Convertback (type object type, type target type, object parameter, cultureinfo culture) {return tap; In the definition of a grid in the column, I tried to use this converter, but received an error in which the IVALueConverter does not support converting with TypeConverter string. I know that control: textbox hailer. Label is a string:

  & lt; Column Definition Width = "{TemplateBinding Controls: TextboxHelper.Label, Converter = ToWidth}" />   

Why did this happen and what is the solution?

I just change this line:

  & lt; Column Definition Width = "{TemplateBinding Controls: TextboxHelper.Label, Converter = ToWidth}" />   

to:

  & lt; Column Definition Width = "{TemplateBinding Control: TextboxHelper.Label, Converter = {StaticResource ToWidth}}" />    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -