예제 #1
0
		Android.Views.View GetTheView (int position, TreeItem item, Android.Views.View convertView)
		{
			var view = convertView;
			if (view == null) {
				view = LayoutInflater.Inflate (Resource.Layout.TreeCell, null);
				TextView level1TV = view.FindViewById<TextView> (Resource.Id.level1Text);
				TextView level2TV = view.FindViewById<TextView> (Resource.Id.level2Text);
				TextView level3TV = view.FindViewById<TextView> (Resource.Id.level3Text);
				view.Tag = new ViewHolder (){ Level1TV = level1TV, Level2TV = level2TV, Level3TV = level3TV }; 
			}
			var holder = (ViewHolder)view.Tag;
			//set up cell depending on level
			switch (item.Level) {
			case 1:
				holder.Level1TV.Text = item.ItemToDisplay;
				holder.Level2TV.Text = "      ";
				holder.Level3TV.Text = "      ";
				break;
			case 2:
				holder.Level1TV.Text = "      ";
				holder.Level2TV.Text = item.ItemToDisplay;
				holder.Level3TV.Text = "      ";
				break;
			case 3:
				holder.Level1TV.Text = "      ";
				holder.Level2TV.Text = "      ";
				holder.Level3TV.Text = item.ItemToDisplay;
				break;
			}
			return view;
		}
예제 #2
0
		public void UpdateCell(TreeItem item)
		{
			switch (item.Level) {
			case 1:
				Level1Label.Text = item.ItemToDisplay;
				Level2Label.Text = "";
				Level3Label.Text = "";
				break;
			case 2:
				Level1Label.Text = "";
				Level2Label.Text = item.ItemToDisplay;
				Level3Label.Text = "";
				break;
			case 3:
				Level1Label.Text = "";
				Level2Label.Text = "";
				Level3Label.Text = item.ItemToDisplay;
				break;
			}
		}