user763554
user763554

Reputation: 2041

How to do a binding in Xaml?

I have a Linq query below with 'product' containing sub-elements 'Name' and 'Price' in an XML file.

var queryAllProducts = from product in products 
select new { 
    Product = product 
,   PriceEuro = UsdToEuro(product.PriceUsd) 
}; 

In my xaml file, I can bind a Textblock to PriceEuro with

<TextBlock Text= "{Binding PriceEuro}" />

How do I bind a TextBlock to 'Name'? Text = "{Binding Product.Name}" didn't work for me. Thanks.

Upvotes: 0

Views: 61

Answers (1)

mauris
mauris

Reputation: 43619

Text="{Binding Path=Product.Name}"

Use Path.

Upvotes: 1

Related Questions