/// <summary> /// Creates the view holder. /// </summary> /// <returns>The created view holder</returns> /// <param name="parent">Parent</param> /// <param name="viewType">View type</param> public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View myView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.DirectionsLayout, parent, false); DirectionsHolder dh = new DirectionsHolder(myView); //create a new holder and pass the view through the constructor return(dh); }
/// <summary> /// Binds the view to the recyclerview view holder and sets the current item in the directions list. /// </summary> /// <param name="holder">Holder</param> /// <param name="position">Position</param> public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { DirectionsHolder dh = holder as DirectionsHolder; //create new direction holder dh.directions.Text = "Step " + (position + 1).ToString() + ": " + dataSet[position]; //set the text to the current position }