NoobDeveloper
NoobDeveloper

Reputation: 1887

How to get contacts address from Contacts.SearchAsync results?

I am binding a listbox with contacts address using following xaml code

<ListBox Name="ContactResultsDataLINQ" ItemsSource="{Binding}" Height="200" Margin="24,0,0,0" DataContext="{Binding}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding Path=Addresses[0].PhysicalAddress.AddressLine1, Mode=OneWay}" />
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

However, this only binds AddressLine1...what i want it complete address = AddressLine1 + AddressLine2 + City

Now how do i append this additional properties via xaml code ?

Upvotes: 0

Views: 292

Answers (1)

Claus J&#248;rgensen
Claus J&#248;rgensen

Reputation: 26347

Either use two TextBlock elements, or combine it in a single, using Run elements.

<TextBlock>
    <Run Text="{Binding Path=Addresses[0].PhysicalAddress.AddressLine1, Mode=OneWay}" />
    <Run Text=" " />
    <Run Text="{Binding Path=Addresses[0].PhysicalAddress.AddressLine2, Mode=OneWay}" />
    <Run Text=" " />
    <Run Text="{Binding Path=Addresses[0].PhysicalAddress.City, Mode=OneWay}" />
</TextBlock>

Upvotes: 2

Related Questions