0

hi i want load some data from database but i dont want to use default wpf grid control i want create a tiny control just like this pic: control

And in some way, like these, I display the information in control:

foreach (var element in data)
{
    myControl.newitem.Title = element.Title;
 myControl.newitem.Content = element.Content;
 myControl.newitem.Image = element.Image;
 myControl.newitem.Date = element.Date ;
}
3
  • 1
    Start reading here: Data Templating Overview. Commented Mar 30, 2018 at 15:03
  • Does it really have to work exactly that way or are you just interested in the end result. You could bind data for the heading and itemssource for the items and template the data to produce that effect. Commented Mar 30, 2018 at 18:26
  • @Clemens tnx Your answer has solved my problem Now I am studying and testing Commented Mar 30, 2018 at 19:20

1 Answer 1

1

I would use the standard WPF ItemsControl for this.

<ItemsControl ItemsSource="{Binding data}">
  <ItemsControl.ItemTemplate>
    <DataTemplate>
        <Grid>
            ....
        </Grid>
    </DataTemplate>
  </ItemsControl.ItemTemplate>
</ItemsControl>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.