LinearGauge
Direction
Features
Sample
Settings
Description
This example demonstrates how to use the direction property with the LinearGauge control.
Source
DirectionController.cs
using MvcExplorer.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcExplorer.Controllers
{
public partial class LinearGaugeController : Controller
{
public ActionResult Direction()
{
ViewBag.DemoSettings = true;
ViewBag.DemoSettingsModel = new ClientSettingsModel
{
Settings = CreateDirectionSettings()
};
return View();
}
private static IDictionary<string, object[]> CreateDirectionSettings()
{
var settings = new Dictionary<string, object[]>
{
{"Direction", new object[]{"Left", "Right", "Down", "Up"}}
};
return settings;
}
}
}
Direction.cshtml
@{
ClientSettingsModel demoSettingsModel = ViewBag.DemoSettingsModel;
}
@section Scripts{
<script>
function customChangeDirection(control, value) {
control.direction = value;
control.invalidate();
if (value === "Left" || value === "Right") {
control.hostElement.style.width = "500px";
control.hostElement.style.height = "1.2em";
} else {
control.hostElement.style.width = "1.2em";
control.hostElement.style.height = "500px";
}
}
</script>
}
@(Html.C1().LinearGauge().Id(demoSettingsModel.ControlId)
.Min(0).Max(10).Value(5)
.Direction(GaugeDirection.Left).Width(500)
)
@section Description{
@Html.Raw(Resources.LinearGauge.Direction_Text0)
}
Documentation