Skip to content

百分比属性

此特性为活字格V9新增功能

csharp
    public class MyPluginServerCommand : Command, ICommandExecutableInServerSideAsync
    {
        [PercentageProperty]
        public double MyProperty { get; set; }

        public async Task<ExecuteResult> ExecuteAsync(IServerCommandExecuteContext dataContext)
        {
            return new ExecuteResult();
        }

        public override CommandScope GetCommandScope()
        {
            return CommandScope.ExecutableInServer;
        }
    }

在设计器中效果如下

1680865074787-5eee840c-21ef-452e-9503-82fccd7af58a.png

注意,标注PercentagePropertyAttribute的属性类型必须是 double, 取值范围为 0 到 1

更新: 2023-04-07 18:59:36
原文: https://www.yuque.com/robert-bh51n/ea8l6c/ecwdrgppwstuvpk5