LinearGauge
Direction
This example demonstrates how to use the direction properties with the LinearGauge controls.
Features
Settings
Direction: Left
Description
This example demonstrates how to use the direction properties with the LinearGauge controls.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using MvcExplorer.Models; 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; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | @ { 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> } < c1-linear-gauge id = "@demoSettingsModel.ControlId" min = "0" max = "10" value = "5" direction = "Left" width = "500px" > </ c1-linear-gauge > @section Description{ @Html .Raw(LinearGaugeRes.Direction_Text0) } |