예제 #1
0
        void CheckedChange(string path, bool isChecked)
        {
            if (IsSelectMany == false)
            {
                Selects.Clear();
                if (isChecked)
                {
                    Selects.Add(path);
                }
                return;
            }

            if (isChecked)
            {
                if (Selects.Contains(path))
                {
                    return;
                }
                Selects.Add(path);
            }
            else
            {
                if (Selects.Contains(path) == false)
                {
                    return;
                }
                Selects.Remove(path);
            }
        }
예제 #2
0
 public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
 {
     if (holder is ItemViewHolder)
     {
         var item     = Items[position];
         var itemView = holder as ItemViewHolder;
         itemView.CheckBox.CheckedChange += (sender, e) => CheckedChange(item.FullName, e.IsChecked);
         itemView.CheckBox.Checked        = Selects.Contains(item.FullName);
         itemView.Path.Text = item.Name;
         itemView.Layout.SetOnClickListener(new AnonymousOnClickListener(v => ItemClick(item)));
         itemView.Path.SetOnClickListener(new AnonymousOnClickListener(v => ItemClick(item)));
         itemView.CheckBox.Visibility = item.IsSelectable ? ViewStates.Visible : ViewStates.Invisible;
         itemView.Icon.SetImageResource(item.Icon);
     }
     if (holder is EmptyItemViewHolder)
     {
     }
 }