ApplyState
Introduction
Code Example - Setting States by Reference
var stateToSet = setMeInCode.ElementSave.Categories
.FirstOrDefault(item => item.Name == "RightSideCategory")
.States.Find(item => item.Name == "Blue");
setMeInCode.ApplyState(stateToSet);Code Example - Setting States by Name
setMeInCode.ApplyState("Green");Code Example - Creating Dynamic States
var dynamicState = new StateSave();
dynamicState.Variables.Add(new VariableSave()
{
Value = 300f,
Name = "Width",
Type = "float",
// values can exist on a state but be "disabled"
SetsValue = true
});
dynamicState.Variables.Add(new VariableSave()
{
Value = 250f,
Name = "Height",
Type = "float",
SetsValue = true
});
setMeInCode.ApplyState(dynamicState);Last updated
Was this helpful?

