views:

46

answers:

1

Hi,

We have one xaml file in our Skins folder where designer has developed some styles for the labels,radiobuttons or checkboxes. I need to find the control, Label in this xaml file and assign the content property at runtime in virewModel so that it can automatically displays the content as per the records in the database. How to achieve this.

Kindly Suggest?

Thanks.

+1  A: 

Why not just have the Label's Content property bound to your view model:

<Label Content="{Binding CustomerName}"/>

HTH,
Kent

Kent Boogaart
@Kent. cuz by finding that label we can give its content property the database field value in a for loop so that it can display different content as per the records in the database as per the label used.Kindly Suggest?
Tarun
Instead of a for loop, have all of your values in a List or Observable collection, then bind that to the ItemsSource of an ItemsControl, with the Label inside the items control's data template.
Matt Casto