DOT

VVM

 DOCS

Version: 1.0 | 1.1 |

MediaList

in namespace DotVVM.Framework.Controls.Bootstrap

Renders Bootstrap Media List. Works with MediaObject controls inside.

Properties

Name Type Description Notes Default Value
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
Attributes Dictionary<String,Object>
attribute
inner element
static value
bindable
default
ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
Static
DataContext Object Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value.
attribute
inner element
static value
bindable
default
DataSource Object Gets or sets the source collection or a GridViewDataSet that contains data in the control.
attribute
inner element
static value
bindable
default
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
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
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
ID String Gets or sets the unique control ID.
attribute
inner element
static value
bindable
default
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
InnerText String Gets or sets the inner text of the HTML element.
attribute
inner element
static value
bindable
default
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
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
Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True
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

Events

Name Type Description

Usage & Scenarios

Renders Bootstrap Media List. Use the MediaObject controls inside.

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

HTML Rendered by the Control

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="~/Images/person.png"
                  AlternateText="TEST" Header="Basic Image" Description="Simple Description" />

  <bs:MediaObject ImageUrl="~/Images/person.png"
                  AlternateText="TEST" Header="Basic Image" Description="Simple Description" />

</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}" />
using DotVVM.Framework.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.MediaList.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public List<MediaItem> Medias { get; set; } = new List<MediaItem>()
        {
            new MediaItem() { ImageUrl = "/Content/Images/img12.jpg", AltText = "google alt", NavigateUrl = "https://www.google.cz/",
                Header = "Google", Description = "This is description for Google", Width = "100", Height = "200" },
            new MediaItem() { ImageUrl = "/Content/Images/img12.jpg", AltText = "w3schools alt", NavigateUrl = "http://www.w3schools.com/",
                Header = "W3Schools", Description = "This is description for W3Schools", Width = "300", Height = "200" },
            new MediaItem() { ImageUrl = "/Content/Images/img12.jpg", AltText = "bootstrap alt", NavigateUrl = "http://getbootstrap.com/",
                Header = "Bootstrap", Description = "This is description for Bootstrap", Width = "200", Height = "100" },
            new MediaItem() { ImageUrl = "/Content/Images/img12.jpg", AltText = "dotvvm alt", NavigateUrl = "https://www.dotvvm.com/",
                Header = "DotVVM", Description = "This is description for DotVVM", Width = "50", Height = "50" }
        };
    }

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

Suggestions


Help & Contribute

The documentation is maintained on GitHub.
We'll be happy if you edit the page and create a pull request.

Send message