I am dynamically adding Tabitems to a Tab Control at runtime (in C#) and that works OK, but how can I then dynamically add controls to the new Tabitems? The Tabitems need to be dynamic because they depends on how many rows of data are read from a database. The layout of each Tabitem will be identical. Thanks
标签:
wpf-controls
相关问题
- Animate a WPF Window left and right with a shake e
- C# WPF Rating Control Similar to Wifi Signal Indic
- Access property of element in controltemplate in X
- Windows 8 WPF progress bars don't have glow an
- WPF MeasureOverride and ArrangeOverride
相关文章
- WPF - Adding dynamic controls to dynamically added
- How to set x, y coordinates of WPF canvas children
- What is touch event in WPF?
- Binding a Style Setter Value properly
- Intellisense supported TextBox in WPf
- WPF Custom Control: TemplateBinding to Image
- WPF: How to make HeaderedContentControl.Content fi
- Capture coloured console output into WPF applicati
The TabItem is a content control, so just set its Content property to be any type of element you wish to display (e.g. a Grid containing other elements etc)
Use the Content property of the new TabItem, there you can set anything, like strings or other WPF controls:
If each
TabItem
is going to have the same layout I would simply create aUserControl
which encompasses what you need from a layout and control stance and then place that within theTabItem.Content
property.You could then pass the data via object representation to the
TabItem.DataContext
property to initiate and make use of binding.