Version: 2.0 |

MediaObject

in namespace DotVVM.Framework.Controls.Bootstrap4

Renders a clickable image with description inside Bootstrap Media List.

Properties

Name Type Description Notes Default Value
AlternateText String Gets or sets the alternate text of the image.
attribute
inner element
static value
bindable
default
ContentTemplate ITemplate Gets or sets the content inside the Media object. Use this property if you don't want the default template.
attribute
inner element
static value
bindable
default
Description String Gets or sets the description text in the default content template. Do not use this property in combination with the ContentTemplate property.
attribute
inner element
static value
bindable
default
Enabled Boolean Gets or sets whether this image link is enabled.
attribute
inner element
static value
bindable
default
True
HeaderText String Gets or sets the header text in the default content template. Do not use this property in combination with the ContentTemplate property.
attribute
inner element
static value
bindable
default
Height String Gets or sets the height of the image.
attribute
inner element
static value
bindable
default
ImageType ImageType Gets or sets the type of the image - e.g. rounded, circle, responsive etc.
attribute
inner element
static value
bindable
default
Default
ImageUrl String Gets or sets the URL of the image.
attribute
inner element
static value
bindable
default
MediaTemplate ITemplate Gets or sets a template for a custom content to be used instead of the image.
attribute
inner element
static value
bindable
default
NavigateUrl String Gets or sets the URL of the hyperlink.
attribute
inner element
static value
bindable
default
NestedItems List<MediaObject> Gets or sets nested Media objects.
attribute
inner element
static value
bindable
default
Position MediaHorizontalPosition Gets or sets whether the image is on the left or the right side.
attribute
inner element
static value
bindable
default
Left
RouteName String Gets or sets the name of the route which will be used to generate the URL.
attribute
inner element
static value
bindable
default
UrlSuffix String Gets or sets the suffix that will be appended to the generated URL.
attribute
inner element
static value
bindable
default
VerticalAlignment VerticalAlignment Gets or sets the vertical alignment of the image.
attribute
inner element
static value
bindable
default
None
Width String Gets or sets the width of the image.
attribute
inner element
static value
bindable
default

Events

Name Type Description
Click Action Gets or sets the command that will be triggered when the image is clicked.

Usage & Scenarios

Renders Bootstrap Media Object.

https://getbootstrap.com/docs/4.1/layout/media-object/

HTML Rendered by the Control

Sample 1: Basic MediaObject

The MediaObject control has the HeaderText and Description properties which specify the header text and description of the media object.

The ImageUrl and AlternateText property sets the URL and the alt text of the image.

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

Sample 2: Media Object Templates

The MediaObject control supports templating for media content and body.

You can use the MediaTemplate property to define any content for the media section.

Also, instead of HeaderText and Description, you can use the ContentTemplate to specify your own content.

<bs:MediaObject>
  <MediaTemplate>
    <iframe width="300" height="180" src="https://www.youtube.com/embed/fJ9rUzIMcZQ" frameborder="0" allowfullscreen=""></iframe>
  </MediaTemplate>
  <ContentTemplate>
    <h1>Header</h1>
    <p>Description defined in content template.</p>
  </ContentTemplate>
</bs:MediaObject>

Sample 3: Nested MediaObjects

<bs:MediaList>

    <bs:MediaObject ImageUrl="~/Images/person.png" VerticalAlignment="Top" AlternateText="TEST">

        <ContentTemplate>
            <h4>Media object in list</h4>
            <p>Description in template</p>

            <bs:MediaObject ImageUrl="~/Images/person.png" VerticalAlignment="Top" AlternateText="TEST">
                <ContentTemplate>
                    <h4>Child</h4>
                    <p>Description of a child</p>

                    <bs:MediaObject HeaderText="Nested Media Object" Description="Simple description" VerticalAlignment="Top">
                        <ImageTemplate>
                            <iframe width="300" height="180" src="https://www.youtube.com/embed/fJ9rUzIMcZQ" frameborder="0" allowfullscreen=""></iframe>
                        </ImageTemplate>
                    </bs:MediaObject>

                </ContentTemplate>

            </bs:MediaObject>
        </ContentTemplate>

    </bs:MediaObject>

    <bs:MediaObject ImageUrl="~/Images/person.png" VerticalAlignment="Top" AlternateText="TEST" />

</bs:MediaList>

Sample 4: MediaObject Alignment

The Positon property specifies whether the image is on the left or on the right side.

You can use the VerticalAlignment property to specify the vertical alignment of the image within the row.

<bs:MediaObject ImageUrl="~/Images/person.png" 
                HeaderText="Basic Image" 
                Description="Simple Description"
                VerticalAlignment="Bottom"
                Position="Right" />

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