Dont change text for the button - functionality more and less

Hello,
I tried to change text of the button after pressing (I want "less"), but it doesnt work well.

`public void btnOneClick(View v){
var button = (Button)v;
TextView myTextView = null;
int maxLines = 0;

        switch (button.Tag.ToString())
        {
        case "event":
            System.Diagnostics.Debug.Write ("event");
            myTextView = eventText;
            maxLines = linesEvent;
            break;
        case "quote":
            System.Diagnostics.Debug.Write ("quote");
            myTextView = quoteText;
            maxLines = linesQuote;
            break;
        case "word":
            System.Diagnostics.Debug.Write ("word");
            myTextView = wordText;
            maxLines = linesWord;
            break;
        case "article":
            System.Diagnostics.Debug.Write ("article");
            myTextView = articleText;
            maxLines = linesArticle;
            break;
        case "thought":
            System.Diagnostics.Debug.Write ("thought");
            myTextView = thoughtText;
            maxLines = linesThought;
            break;
        default:
            break;
        }


        if (button.Text.Equals ("more...")){

            myTextView.SetMaxLines (maxLines);
            System.Diagnostics.Debug.WriteLine ("zavolalo se more");
            //button.Text = "less...";
            button.SetText (Resource.String.less);
        }
        /*
        if (button.Text.Equals ("less...")) {

            //button.SetMaxLines (3);
            myTextView.SetMaxLines (3);
            myTextView.Text ="roztahni se";
            //button.Text = "more...";
        }*/

    }`

Thank you

Sign In or Register to comment.