Facebook
Twitter
Pinterest
Tumblr
GitHub
RSS
  • DEV Home
  • Documentation
  • Reference
  • Download
Search Results for

    Show / Hide Table of Contents

    Features: Conditions

    Conditions can be declared with attributes and are evaluated at the client after each value change. Conditions can be used to control two things

    • Enabled/Disabled State
    • Control Visibility

    Condition attributes are applied to the property whose associated control(s) should be affected by the condition. The condition can reference any other value(s) which should be evaluated for the conditional state change.

    Simple Conditions

    Simple Show/Hide Condition

    Checking/unchecking will show or hide another control

    [DisplayName("Boolean Value")]
    [Description("Checking/unchecking will show or hide another control")]
    public bool SimpleBoolValue { get; set; }
    
    [DisplayName("Conditionally Visible Value")]
    [Description("This is the description.")]
    [VisibleCondition(nameof(SimpleBoolValue), SimpleCondition.IsTrue)]
    public string DemoName1 { get; set; } = "GenericEdit Demo";
    

    Simple Enable/Disable Condition

    Checking/unchecking will enable or disable the control below

    [DisplayName("Boolean Value")]
    [Description("Checking/unchecking will enable or disable the control below")]
    public bool SimpleBoolValue2 { get; set; }
    
    [DisplayName("Conditionally Enabled Select")]
    [Description("This is the description.")]
    [EnabledCondition(nameof(SimpleBoolValue2), SimpleCondition.IsTrue)]
    public VideoCodecTypes SimpleEnumSelect { get; set; }
    

    Value Conditions

    Show/Hide by Enum Value Selection

    Selecting 'Don't know' will show a message

    [DisplayName("Selecting 'Don't know' will show a message")]
    [Description("This is the description.")]
    public StayOrGo StayOrGoSelect { get; set; } = StayOrGo.Go;
    
    [VisibleCondition(nameof(StayOrGoSelect), ValueCondition.IsEqual, StayOrGo.DontKnow)]
    public LabelItem StayOrGoLabel { get; set; } = new LabelItem("IT'S TIME TO MAKE A DECISION!");
    

    Referencing Nested Values

    Show/Hide by Enum Value Selection

    Values of child properties can be referenced using 'dot' notation like this:

    [DisplayName("File Import 1")]
    public ChildOptionExample ChildOption1 { get; set; } = new ChildOptionExample();
    
    [DisplayName("File Import 2")]
    [VisibleCondition(nameof(ChildOption1) + "." + nameof(ChildOptionExample.File), SimpleCondition.IsNotNullOrEmpty)]
    public ChildOptionExample ChildOption2 { get; set; } = new ChildOptionExample();
    
    SDK
    On this Page
    Back to Top Copyright 2022 © EMBY LLC. Please see our terms of use and privacy policy.