Mikael Gyth
Topic Author
Posts: 33
Joined: 15 Aug 2013, 12:53

Support for StringFormat and MultiBinding?

22 Sep 2013, 12:38

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.
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: Support for StringFormat and MultiBinding?

23 Sep 2013, 10:04

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.
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Support for StringFormat and MultiBinding?

23 Sep 2013, 13:20

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)
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Support for StringFormat and MultiBinding?

26 Sep 2013, 13:54

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.

Who is online

Users browsing this forum: No registered users and 1 guest