View Issue Details

IDProjectCategoryView StatusLast Update
0001557NoesisGUIC++ SDKpublic2019-10-11 10:32
ReportertkawaAssigned Tosfernandez 
Status resolvedResolutionno change required 
Product Version2.2.5 
Target Version2.2.6Fixed in Version2.2.6 
Summary0001557: Support FontSizeConverter to convert string to float
DescriptionFollow up from

I'd like to bind FontSize and specify "pt".
In WPF, it can convert from string to double by FontSizeConverter().

<TextBlock  FontSize="{Binding FontSize}"... />

float GetFontSize() const{
    NsString fontSizeString = "20pt";
    float fontSize;
    //Convert from NsString to float
    return fontSize;
TagsNo tags attached.




2019-10-10 12:34

manager   ~0005989

I've been doing some tests in WPF and it looks like WPF doesn't allow that either.
I have a TextBlock with its FontSize bound to a string property in my ViewModel and WPF doesn't know how to convert it:
<TextBlock Text="This text's size is bound to a string" FontSize="{Binding TextSize}"/>

public class ViewModel
    public string TextSize { get; set; }

DataContext = new ViewModel { TextSize = "30pt" };

I was surprised by this behavior because I though WPF will use TypeConverter attribute specified in the FontSize property, but I found that bindings ignore that attribute and only use TargetProperty.PropertyType to decide which dynamic converter it should create. In this situation is creating a SystemConvertConverter that just calls Convert.ChangeType from String to Double which is trying to parse a double from the string, and is failing because of the "pt" suffix.

At the end FontSizeConverter is only used when parsing the xaml, and we already support that, should we close this?


2019-10-11 05:25

reporter   ~0005990

I see it.
I had thought that it have to bind as float.
It was solved by returning NsString.
Thank you very much!!

Issue History

Date Modified Username Field Change
2019-09-30 06:54 tkawa New Issue
2019-09-30 10:03 sfernandez Assigned To => sfernandez
2019-09-30 10:03 sfernandez Status new => assigned
2019-09-30 10:03 sfernandez Product Version => 2.2.5
2019-09-30 10:03 sfernandez Target Version => 2.3.0
2019-10-04 17:08 sfernandez Summary Suppoert FontSizeConverter to convert string to float => Support FontSizeConverter to convert string to float
2019-10-04 17:08 sfernandez Description Updated View Revisions
2019-10-04 17:09 sfernandez Description Updated View Revisions
2019-10-04 17:10 sfernandez Description Updated View Revisions
2019-10-10 12:34 sfernandez Status assigned => feedback
2019-10-10 12:34 sfernandez Note Added: 0005989
2019-10-11 05:02 tkawa Description Updated View Revisions
2019-10-11 05:25 tkawa Note Added: 0005990
2019-10-11 05:25 tkawa Status feedback => assigned
2019-10-11 10:31 sfernandez Status assigned => resolved
2019-10-11 10:31 sfernandez Resolution open => no change required
2019-10-11 10:31 sfernandez Fixed in Version => 2.2.6
2019-10-11 10:32 sfernandez Target Version 2.3.0 => 2.2.6