Block Elements
posted 2007-04-09
Unlike Inline elements, Block elements take up the entire width of the text column and have line breaks before and after their content. By far, the most common block element is Paragraph.
Here are the elements that shipped with WPF that derive from Block:
Paragraph: With a straightforward name, this element (along withTextBlock) is the only container forInlineelements.Section: A container for otherBlockelements -- analogous toSpan, which containsInlineelements.BlockUIContainer: A container forUIElement-derived classes to be displayed as a block. Analogous toInlineUIElement.List: Creates an ordered or unordered list. ContainsListItemelements.Table: ContainsTableRowGroupelements.
Additionally, there are a few helper classes that are a bit block-ish:
ListItem:Blockcontainer for use within aList.TableRowGroup: Container forTableRowobjects.TableRow: Container forTableCellobjects.TableCell:Blockcontainer for use within aTableRow.
Just like the inline elements, all of these elements do not derive from UIElement or Visual -- this is because they do not have a one-to-one mapping between their content and visuals on screen. The reasons for this, and their ramifications, will have to wait for the next post.
Differences from HTML
- No nested paragraphs: It's worth re-iterating, because you'll probably run into it some time.
- Strict structure for Lists and Tables: WPF is strict about the structure of Lists and, in particular, Tables. This leads to verbose markup.
- Only one
List: Unlike HTML, there are no specialized elements for ordered and unordered list. You use theMarkerStyleproperty.