Seeing your code I could notice why the @sme's answer doesn't fit you. You're making a very confusing and poor use of bindings
and xaml
, and I'm quite sure that move to MVVM
is the best thing you can do now.
But, if you insist to keep the code like it is now, you can just add the Reply text bound to the Entry's text property, like that:
<Entry Placeholder="Reply..."
HorizontalOptions="FillAndExpand"
Margin="0, 0, 0, 5"
Text="{Binding Reply}"/>
So, as you are sending the entire MessageObject
object to the tap command, you'll be able to get the text content just this way:
public void ReplyCommandClick(string id, object msg)
{
MessageObject message = (MessageObject) msg;
message.ShowReplyField = message.ShowReplyField ? false : true;
//var viewcell = (MessageObject)((Label)msg).BindingContext;
//viewcell. // There were no options for the entry
var reply = msg.Reply;
SendReply(id, msg, reply);
}
element
of theItemsSource
of yourListView
. That's the cleanest approach. You only need to get the appropriate index – mr5