MVVMCross enable button with linearLayout ?

ChristopheBERNARDChristopheBERNARD BEMember ✭✭✭✭✭

Hello all,
i'm a beginner with mobile and mvvmcross ...
i have a solution who contains a core and a droid project

In my project droid, i have installed the signaturePad componend who is really nice to use and simply to add in project.

on my view i have a button and off course a linearLayout => use for signaturePad

Now i would like while the linearLayout doesn't contains any signature that the button still disable but i don't know how i can do that ..

Any idea ?

Here is it my solution but doesn't work

on my axml for the linearLayout i have this
local:MvxBind="Touch CmdActiveButton"/> => try with TouchUp Click but no luck

on my button i have this
local:MvxBind="Click ConfirmSignPad", Enabled HasSignature" />

the code of the viewModel
`
private bool hasSignature;
public bool HasSignature
{
get { return hasSignature; }
set { hasSignature = value; RaisePropertyChanged(() => HasSignature); }
}

    private MvxCommand cmdActiveButton;
    public ICommand CmdActiveButton
    {
        get
        {
            cmdActiveButton = cmdActiveButton = new MvxCommand(DoCmdActiveButton);
            return cmdActiveButton;
        }
    }

    private void DoCmdActiveButton()
    {
        HasSignature = true;
    }

`

when i run the app the button is well DISABLE but when i sign => touch / click / force :) on the linearLayout nothing happen's ...

i've try to search on internet but nothing found ...

Any idea about how i can ENABLE a button on click or touch on linearLayout ?

thanks for your time

Posts

  • GeoffAGeoffA USMember ✭✭

    You may need to make the LinearLayout clickable.

        android:clickable="true"
    

    The other option would be to detect the start of writing in the Signature Pad Control and set the HasSignature flag so that the button can respond to it. You might have to make the button binding OneWay from the ViewModel to the button.

  • ChristopheBERNARDChristopheBERNARD BEMember ✭✭✭✭✭
    edited August 2016

    Hello @GeoffAldridge.4298

    thanks for your reply i've try to add the line android:clickable="true" on the linearLayout and a mvvm cross command as this

    '
    LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    local:MvxBind="Click CmdActiveButton"
    '

    but nothing happen when i ckick on screen ...arghhhh ...

    yes as you said the rigth solution would be to know when the user begin to sign ...but actually i don't know how to know that ...
    i've search again, but if i can't do that i think i will enable the button every time and when user click on button if there isn't a signature i will display a toast message ...

    For more information, next to the linear layout i have 3 buttons

    • clear => clear the signature
    • cancel => back
    • confirm => save signature in db

    clear and cancel buttons works well with MVVMCross , my level with mvvmcross is very low (just several hours) ...hm hm i will check today but if no solution i will pass with a toast and discuss with the responsable of this project ...

    Thanks for your help and your knowledge that's great to share them :)

Sign In or Register to comment.