简体   繁体   中英

create custom grid control wpf

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 ;
}

I would use the standard WPF ItemsControl for this.

<ItemsControl ItemsSource="{Binding data}">
  <ItemsControl.ItemTemplate>
    <DataTemplate>
        <Grid>
            ....
        </Grid>
    </DataTemplate>
  </ItemsControl.ItemTemplate>
</ItemsControl>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM