Пример #1
0
    /// <summary>
    /// OnParametersSet 方法
    /// </summary>
    protected override void OnParametersSet()
    {
        base.OnParametersSet();

        LeftPanelText ??= Localizer[nameof(LeftPanelText)];
        RightPanelText ??= Localizer[nameof(RightPanelText)];

        var list = CurrentValueAsString.Split(',', StringSplitOptions.RemoveEmptyEntries);

        LeftItems.Clear();
        RightItems.Clear();

        Items ??= Enumerable.Empty <SelectedItem>();

        // 左侧移除
        LeftItems.AddRange(Items);
        LeftItems.RemoveAll(i => list.Any(l => l == i.Value));

        // 右侧插入
        foreach (var t in list)
        {
            var item = Items.FirstOrDefault(i => i.Value == t);
            if (item != null)
            {
                RightItems.Add(item);
            }
        }
    }
 private void MoveToRight(ListItemViewModel item)
 {
     if (item != null)
     {
         LeftItems.Remove(item);
         RightItems.Add(item);
     }
 }