BinarySmartListBoxItem
A card in a BinarySmartListBox: a rounded box holding a picture, a bold title and a
line or two of text – or any content of your own.
public class BinarySmartListBoxItem : ListBoxItem
Inherits from / implements: ListBoxItem
Remarks
A card with an ItemTitle shows ItemImage at its left, the title,
and BodyContent beneath it, each with its own font and colour properties. A card whose
ItemTitle is null or empty shows its
ContentControl.Content instead.
The card is drawn as a border (ItemBorderBrush,
ItemBorderBackgroundBrush,
ItemBorderThickness, ItemBorderCornerRadius) set in by
ItemBorderMargin and padded by ItemBorderPadding. It casts a soft
shadow under the pointer, and the selected card takes the selection colours of
BinarySmartListResources. The look comes from the list's
ItemsControl.ItemContainerStyle, so a card is drawn this way only inside a
BinarySmartListBox that keeps its built-in item style.
Examples
using System;
using System.Windows.Media.Imaging;
using Binarymission.WPF.Controls.ListControls;
recentReports.Items.Add(new BinarySmartListBoxItem
{
ItemTitle = "Cash flow forecast",
BodyContent = "Next 13 weeks, by bank account.",
BodyContentMaximumWidthForOneLine = 220,
ItemImage = new BitmapImage(new Uri("pack://application:,,,/Images/Forecast.png")),
Tag = "cash-13w"
});Members at a glance
| Properties | |
|---|---|
BodyContent | Gets or sets the text under the card's title – a description, a date, a summary. |
BodyContentFontFamily | Gets or sets the typeface of the text under the card's title. |
BodyContentFontSize | Gets or sets the size of the text under the card's title. |
BodyContentFontStretch | Gets or sets how condensed or expanded the text under the card's title is drawn, where the typeface offers it. |
BodyContentFontStyle | Gets or sets whether the text under the card's title is upright or italic. |
BodyContentFontWeight | Gets or sets how heavy the text under the card's title is drawn. |
BodyContentMargin | Gets or sets the space around the text under the card's title. |
BodyContentMaximumWidthForOneLine | Gets or sets the width of the text under the card's title; longer text wraps onto further lines. |
ItemBodyContentBrush | Gets or sets the colour of the text under the card's title. |
ItemBorderBackgroundBrush | Gets or sets the fill of the card. |
ItemBorderBrush | Gets or sets the colour of the card's outline. |
ItemBorderCornerRadius | Gets or sets how rounded the card's corners are. |
ItemBorderMargin | Gets or sets the space around the card, separating it from its neighbours. |
ItemBorderPadding | Gets or sets the space between the card's outline and its contents. |
ItemBorderThickness | Gets or sets the width of the card's outline. |
ItemImage | Gets or sets the picture at the left of the card – an icon, a thumbnail or a photo. |
ItemTitle | Gets or sets the card's title, shown in bold at the top of the card. |
ItemTitleBrush | Gets or sets the colour of the card's title. |
ItemTitleFontFamily | Gets or sets the typeface of the card's title. |
ItemTitleFontSize | Gets or sets the size of the card's title text. |
ItemTitleFontStretch | Gets or sets how condensed or expanded the card's title is drawn, where the typeface offers it. |
ItemTitleFontStyle | Gets or sets whether the card's title is upright or italic. |
ItemTitleFontWeight | Gets or sets how heavy the card's title is drawn. |
ItemTitleTextMargin | Gets or sets the space around the card's title. |
| Fields | |
BodyContentFontFamilyProperty | Identifies the BodyContentFontFamily dependency property. |
BodyContentFontSizeProperty | Identifies the BodyContentFontSize dependency property. |
BodyContentFontStretchProperty | Identifies the BodyContentFontStretch dependency property. |
BodyContentFontStyleProperty | Identifies the BodyContentFontStyle dependency property. |
BodyContentFontWeightProperty | Identifies the BodyContentFontWeight dependency property. |
BodyContentMarginProperty | Identifies the BodyContentMargin dependency property. |
BodyContentMaximumWidthForOneLineProperty | Identifies the BodyContentMaximumWidthForOneLine dependency property. |
BodyContentProperty | Identifies the BodyContent dependency property. |
ItemBodyContentBrushProperty | Identifies the ItemBodyContentBrush dependency property. |
ItemBorderBackgroundBrushProperty | Identifies the ItemBorderBackgroundBrush dependency property. |
ItemBorderBrushProperty | Identifies the ItemBorderBrush dependency property. |
ItemBorderCornerRadiusProperty | Identifies the ItemBorderCornerRadius dependency property. |
ItemBorderMarginProperty | Identifies the ItemBorderMargin dependency property. |
ItemBorderPaddingProperty | Identifies the ItemBorderPadding dependency property. |
ItemBorderThicknessProperty | Identifies the ItemBorderThickness dependency property. |
ItemImageProperty | Identifies the ItemImage dependency property. |
ItemTitleBrushProperty | Identifies the ItemTitleBrush dependency property. |
ItemTitleFontFamilyProperty | Identifies the ItemTitleFontFamily dependency property. |
ItemTitleFontSizeProperty | Identifies the ItemTitleFontSize dependency property. |
ItemTitleFontStretchProperty | Identifies the ItemTitleFontStretch dependency property. |
ItemTitleFontStyleProperty | Identifies the ItemTitleFontStyle dependency property. |
ItemTitleFontWeightProperty | Identifies the ItemTitleFontWeight dependency property. |
ItemTitleProperty | Identifies the ItemTitle dependency property. |
ItemTitleTextMarginProperty | Identifies the ItemTitleTextMargin dependency property. |
Properties
BodyContent
Gets or sets the text under the card's title – a description, a date, a summary.
- Value
- The text, wrapped to
BodyContentMaximumWidthForOneLinewhen that is set. The default is an empty string.
Remarks
Shown only on a card with an ItemTitle.
BodyContentFontFamily
Gets or sets the typeface of the text under the card's title.
- Value
- The default is
null, which gives the text no typeface of its own.
BodyContentFontSize
Gets or sets the size of the text under the card's title.
- Value
- The size in logical pixels (1/96 inch); the default is 12.
BodyContentFontStretch
Gets or sets how condensed or expanded the text under the card's title is drawn, where the typeface offers it.
- Value
- The default is
Normal.
BodyContentFontStyle
Gets or sets whether the text under the card's title is upright or italic.
- Value
- The default is
Normal.
BodyContentFontWeight
Gets or sets how heavy the text under the card's title is drawn.
- Value
- The default is
Normal.
BodyContentMargin
Gets or sets the space around the text under the card's title.
- Value
- The margin in logical pixels (1/96 inch); the default is 10 on the left, 5 on the right and none above or below.
BodyContentMaximumWidthForOneLine
Gets or sets the width of the text under the card's title; longer text wraps onto further lines.
- Value
- The width in logical pixels (1/96 inch). The default,
NaN, sizes the text to its length on one line; set a width – 200 to 260 suits most cards – to wrap it.
Remarks
A width that is set is fixed, not a maximum: the text block is this wide however short its text, and so it sets the width of the card.
Example
<nav:BinarySmartListBoxItem ItemTitle="Stock levels"
BodyContent="Lines below their reorder point, by warehouse."
BodyContentMaximumWidthForOneLine="240" />ItemBodyContentBrush
Gets or sets the colour of the text under the card's title.
- Value
- The default with no skin in force is the system window text colour
(
WindowTextBrush); a Binarymission skin gives it its secondary text colour.
ItemBorderBackgroundBrush
Gets or sets the fill of the card.
- Value
- The default with no skin in force is
LightCyan; a Binarymission skin supplies its own. The selected card is filled with the selection colour instead (BinarySmartListResources.ItemSelectionBackgroundBrush).
ItemBorderBrush
Gets or sets the colour of the card's outline.
- Value
- The default with no skin in force is
DarkCyan; a Binarymission skin supplies its own. The selected card is outlined in the selection colour instead.
See also
ItemBorderCornerRadius
Gets or sets how rounded the card's corners are.
- Value
- The radius in logical pixels (1/96 inch); the default is 4 at every corner. 0 gives square corners.
ItemBorderMargin
Gets or sets the space around the card, separating it from its neighbours.
- Value
- The margin in logical pixels (1/96 inch); the default is 2 on the left, 6 above, 3 on the right and 6 below.
ItemBorderPadding
Gets or sets the space between the card's outline and its contents.
- Value
- The padding in logical pixels (1/96 inch); the default is 8 on every side.
ItemBorderThickness
Gets or sets the width of the card's outline.
- Value
- The width in logical pixels (1/96 inch), the same on every side; the default is 1. 0 draws no outline.
ItemImage
Gets or sets the picture at the left of the card – an icon, a thumbnail or a photo.
- Value
- The picture, shown at its own size beside the title and body text. The default is
null: no picture.
Remarks
Shown only on a card with an ItemTitle. In XAML a path or pack URI can be
given directly: ItemImage="/Images/Chart.png".
ItemTitle
Gets or sets the card's title, shown in bold at the top of the card.
- Value
- The title, on one line. The default is an empty string.
Remarks
While the title is null or empty the card shows its
ContentControl.Content instead of the picture, title and body text; give
it a title to
use them.
ItemTitleBrush
Gets or sets the colour of the card's title.
- Value
- The default with no skin in force is the system window text colour
(
WindowTextBrush); a Binarymission skin supplies its own.
ItemTitleFontFamily
Gets or sets the typeface of the card's title.
- Value
- The default is
null, which gives the title no typeface of its own.
ItemTitleFontSize
Gets or sets the size of the card's title text.
- Value
- The size in logical pixels (1/96 inch); the default is 14.
ItemTitleFontStretch
Gets or sets how condensed or expanded the card's title is drawn, where the typeface offers it.
- Value
- The default is
Normal.
ItemTitleFontStyle
Gets or sets whether the card's title is upright or italic.
- Value
- The default is
Normal.
ItemTitleFontWeight
Gets or sets how heavy the card's title is drawn.
- Value
- The default is
Normal;SemiBoldorBoldmakes the title stand out from the body text.
ItemTitleTextMargin
Gets or sets the space around the card's title.
- Value
- The margin in logical pixels (1/96 inch); the default is 10 on the left, 5 on the right and none above or below. The title sits a further 10 in from the picture and 5 above the body text, whatever this margin is.
Fields
BodyContentFontFamilyProperty static
Identifies the BodyContentFontFamily dependency property.
BodyContentFontSizeProperty static
Identifies the BodyContentFontSize dependency property.
BodyContentFontStretchProperty static
Identifies the BodyContentFontStretch dependency property.
BodyContentFontStyleProperty static
Identifies the BodyContentFontStyle dependency property.
BodyContentFontWeightProperty static
Identifies the BodyContentFontWeight dependency property.
BodyContentMarginProperty static
Identifies the BodyContentMargin dependency property.
BodyContentMaximumWidthForOneLineProperty static
Identifies the BodyContentMaximumWidthForOneLine dependency property.
BodyContentProperty static
Identifies the BodyContent dependency property.
ItemBodyContentBrushProperty static
Identifies the ItemBodyContentBrush dependency property.
ItemBorderBackgroundBrushProperty static
Identifies the ItemBorderBackgroundBrush dependency property.
ItemBorderBrushProperty static
Identifies the ItemBorderBrush dependency property.
ItemBorderCornerRadiusProperty static
Identifies the ItemBorderCornerRadius dependency property.
ItemBorderMarginProperty static
Identifies the ItemBorderMargin dependency property.
ItemBorderPaddingProperty static
Identifies the ItemBorderPadding dependency property.
ItemBorderThicknessProperty static
Identifies the ItemBorderThickness dependency property.
ItemImageProperty static
Identifies the ItemImage dependency property.
ItemTitleBrushProperty static
Identifies the ItemTitleBrush dependency property.
ItemTitleFontFamilyProperty static
Identifies the ItemTitleFontFamily dependency property.
ItemTitleFontSizeProperty static
Identifies the ItemTitleFontSize dependency property.
ItemTitleFontStretchProperty static
Identifies the ItemTitleFontStretch dependency property.
ItemTitleFontStyleProperty static
Identifies the ItemTitleFontStyle dependency property.
ItemTitleFontWeightProperty static
Identifies the ItemTitleFontWeight dependency property.
ItemTitleProperty static
Identifies the ItemTitle dependency property.
ItemTitleTextMarginProperty static
Identifies the ItemTitleTextMargin dependency property.