MediaList

in namespace DotVVM.Framework.Controls.Bootstrap

Renders Bootstrap Media List. Works with MediaObject controls inside.

Usage & Scenarios

Renders Bootstrap Media List. Use the MediaObject controls inside.

https://getbootstrap.com/docs/3.3/components/#media

Sample 1: MediaList

If you want to render a list of MediaObjects, use this control and place the media objects inside.

<bs:MediaList>

    <bs:MediaObject ImageUrl="https://i3.ytimg.com/vi/m0gjBDswmsA/maxresdefault.jpg"
                    AlternateText="TEST" 
                    HeaderText="DotVVM Minutes #1: Using Bootstrap 4 in a DotVVM app" 
                    Description="Simple Description" 
                    Width="240px" />

    <bs:MediaObject ImageUrl="https://i3.ytimg.com/vi/anXu-v6-roE/maxresdefault.jpg"
                    AlternateText="TEST" 
                    HeaderText="DotVVM Minutes #2: Calling Azure Functions from DotVVM" 
                    Description="Simple Description" 
                    Width="240px" />

</bs:MediaList>

Sample 2: Media List with Data Source

Items inside the MediaList control can be also generated from a collection binded to the DataSource property.

You can specify which properties of objects in the collection will be used to configure the generated items with following properties:

  • ImageUrlBinding
  • AlternateTextBinding
  • NavigateUrlBinding
  • WidthBinding
  • HeightBinding
  • HeaderTextBinding
  • DescriptionBinding
<bs:MediaList DataSource="{value: Medias}" 
              ImageUrlBinding="{value: ImageUrl}"
              AlternateTextBinding="{value: AltText}" 
              NavigateUrlBinding="{value: NavigateUrl}"
              HeaderTextBinding="{value: Header}" 
              DescriptionBinding="{value: Description}"
              WidthBinding="{value: Width}" 
              HeightBinding="{value: Height}" />
public class ViewModel : DotvvmViewModelBase
{
    public List<MediaItem> Medias { get; set; } = new List<MediaItem>()
    {
        new MediaItem()
        {
            ImageUrl = "/Images/1.png",
            AltText = "google alt",
            NavigateUrl = "https://www.google.cz/",
            Header = "Google",
            Description = "This is description for Google",
            Width = "100",
            Height = "200"
        },
        new MediaItem()
        {
            ImageUrl = "/Images/2.png",
            AltText = "w3schools alt",
            NavigateUrl = "http://www.w3schools.com/",
            Header = "W3Schools",
            Description = "This is description for W3Schools",
            Width = "300",
            Height = "200"
        },
        new MediaItem()
        {
            ImageUrl = "/Images/3.png",
            AltText = "bootstrap alt",
            NavigateUrl = "http://getbootstrap.com/",
            Header = "Bootstrap",
            Description = "This is description for Bootstrap",
            Width = "200",
            Height = "100"
        }
    };
}

public class MediaItem
{
    public string ImageUrl { get; set; }
    public string AltText { get; set; }
    public string NavigateUrl { get; set; }
    public string Header { get; set; }
    public string Description { get; set; }
    public string Width { get; set; }
    public string Height { get; set; }
}

Properties

Name Type Description Notes Default Value
property icon AlternateTextBinding IValueBinding Gets or sets the value binding that points to a property which will be used as alternate text to image of the item.
attribute
inner element
static value
bindable
default
null
property icon DataSource Object Gets or sets the source collection or a GridViewDataSet that contains data in the control.
attribute
inner element
static value
bindable
default
null
property icon DescriptionBinding IValueBinding Gets or sets the value binding that points to a property which will be used as description text of the item.
attribute
inner element
static value
bindable
default
null
property icon HeaderTextBinding IValueBinding Gets or sets the value binding that points to a property which will be used as header text of the item.
attribute
inner element
static value
bindable
default
null
property icon HeightBinding IValueBinding Gets or sets the value binding that points to a property which will be used as image height of the item.
attribute
inner element
static value
bindable
default
null
property icon ImageUrlBinding IValueBinding Gets or sets the value binding that points to a property which will be used as the url to image of the item.
attribute
inner element
static value
bindable
default
null
property icon Items List<IListItem> Gets or sets a collection of items that is used when no DataSource is set.
attribute
inner element
static value
bindable
default
null
property icon NavigateUrlBinding IValueBinding Gets or sets the value binding that points to a property which will be used as url to which it will be navigated when clicked on image of the item.
attribute
inner element
static value
bindable
default
null
property icon WidthBinding IValueBinding Gets or sets the value binding that points to a property which will be used as image width of the item.
attribute
inner element
static value
bindable
default
null

HTML produced by the control