Imagine a string that looks like this:
01 02 03 04 05 06 07 08 09
What I would like to do is display this string in a label
, or TextField
, or any other kind of viewable element, but control how the string is displayed, without modifying the string itself. So in this case, the way I want it to look is:
01 02 03 04 05 06 07 08 09
Now I could create a copy of the string, with spaces, or tabs inserted, but this will require modifying the string, I do not wish to do that. I'm looking for a way to control how the string is displayed/rendered.
Can anyone offer any suggestions on how to achieve this?
CodePudding user response:
I think the keyword you're looking for is a Converter. If you use bindings you can add your spaces in the converter. This should then only be for the GUI. This could help you getting started. I think you should also find a lot more explanations and tutorials.
CodePudding user response:
public string Original
{
get { return original;}
set { original = value; On PropertyChanged("UiString");
}
public string UiString
{
get { return Tansform(original) ;}
}