Page 1 of 1

Support for StringFormat and MultiBinding?

Posted: 22 Sep 2013, 12:38
by Mikael Gyth
Does Noesis support StringFormat and MultiBinding?
    <TextBlock>
        <TextBlock.Text>
            <MultiBinding StringFormat="Full Name {0} {1}">
                <Binding Path="FirstName" />
                <Binding Path="LastName" />
             </MultiBinding>
         </TextBlock.Text>
   </TextBlock>
I've attempted to do it but got nothing, no text or errors.

Re: Support for StringFormat and MultiBinding?

Posted: 23 Sep 2013, 10:04
by sfernandez
Hi Mikael,

MultiBinding is not supported. We have it in our feature request list, but is not yet planned in our upcoming releases. I tried to add a xaml containing a MultiBinding, and when it was parsed a warning message was shown in Unity console, are you getting this message also?:
[DX9] Assets/NoesisGUI/Samples/_Tests/_Test/_Test.xaml
Ignoring unknown object 'MultiBinding' (@7,12)
StringFormat is partially implemented. You can use it to determine the representation of numbers, for example:
<TextBlock x:Name="txt" Text="Hello world!" HorizontalAlignment="Left" FontSize="20"/>
<TextBlock Text="{Binding ActualWidth, ElementName=txt, StringFormat=F2}" Margin="0,30"/>
Will use two decimals to represent the width of the first text.
We will add more information to the documentation of StringFormat class to show what exactly is available.

Re: Support for StringFormat and MultiBinding?

Posted: 23 Sep 2013, 13:20
by jsantos
One of the reasons we didn't implement MultiBinding was that Silverlight didn't support it (and I see that Metro doesn't support it either http://dotnet.dzone.com/articles/8-quir ... ows-8-xaml).

But we think it is a good opportunity to offer a better implementation of StringFormat. We will be working on it for the next release (1.0.5)

Re: Support for StringFormat and MultiBinding?

Posted: 26 Sep 2013, 13:54
by jsantos
We have improved the implementation of StringFormat to allow things like this:
<TextBlock Text="{Binding Amount, StringFormat={}{0:D}}" />
<TextBlock Text="{Binding Amount, StringFormat=Total: {0:D}}" />
<TextBlock Text="{Binding Amount, StringFormat=Total: {0:D} units}" />
We support the following formats: C, D, E, F, G, N, P, X and corresponding precision value.

This will be available in NoesisGUI v1.0.5, the next week.