I want to auto create label from database. For ex. I have table [workers] with columns [id][name][sname] etc. When i create new worker i want application to create new Label with his name/sname etc.
I tried binding label manualy but this is not the point.
label1.Text = dt.Rows[0]["Worker_Name"].ToString()
Yeah, i know its not from wpf.
In the last step i want drag&drop app where i will drag&drop workers(label) to new sections, new learders etc but this will be in the future:) (sorry for my english)
EDIT
A WPF solution will be treated differently. This is how I have done it. A DataGrid's ItemSource will be bound and DataContext set in the code behind to an ObservableCollection.
So if you wanted to create labels for all entries in your grid you would iterate through the ObservableCollection and instantiate a new label and set the properties from data in the ObservableCollection. If you want to create the label when the user clicks on an entry in the DataGrid I would do the following (modified from some other code !).
XAML
In The Model
In the Code Behind
I think I understand what you want to achieve. This is from some old C# code I wrote ages ago. I loaded a datagridview up with the data and then iterated through it thus creating labels as needed. As you can see it adds the new labels and a new RichTextBox to a container, the panel and sets property data based on information in the datagrid. It also managed the positioning.
Hope I have understood what you wanted and this helps.
Jim