Windows Phone Multibinding:cimbalino Toolkit

Source: Internet
Author: User

Support for multibinding in WPF and WIN8

What's the use of this, citing the MSDN example http://msdn.microsoft.com/en-us/library/system.windows.data.multibinding.aspx:

MultiBinding allows you to bind a binding target to a list of the source properties and then apply logic to produce a Value with the given inputs. This is example demonstrates how to use multibinding.

In the following example, Namelistdata refers to a collection of PersonName objects, which are-objects that contain two PR Operties, FirstName and LastName. The following example produces a TextBlock that shows the ' the ' and last names ' a person with the ' last name '.

 <textblock name= "TextBox2" datacontext= "{StaticResource namelistdata}" > <TextBlock.Text> <multibinding converter= "{StaticResource mynameconverter}" converterparameter= "Formatlastfirst" > <binding path= "FirstName"/> <binding path= "LastName"/> </MULTIBINDING&G
    
  T </TextBlock.Text> </textblock> 
public class Nameconverter:imultivalueconverter
    
{Public
    
    object Convert (object[] values, Type targettype, Object parameter, CultureInfo culture)
    
    {
    
        string name;
    
     
    
        Switch ((string) parameter)
    
        {case
    
            "Formatlastfirst":
    
                name = values[1] + "," + values[0];
    
                break;
    
            Case "Formatnormal":
    
            default:
    
                name = Values[0] + "" + values[1];
    
                break;
    
     
    
        return name;
    
     
    
    Public object[] Convertback (object value, type[] targettypes, object parameter, CultureInfo culture)
    
    {
    
        string [] Splitvalues = ((string) value). Split (")";
    
        Return splitvalues
    
    }
    
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.