Click here to Skip to main content
15,886,640 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to work out how to bind button in xaml.cs file instead of xaml. At present I have the following code in my xaml

Command="{Binding Page}" CommandParameter="AddEmployee" Content="Add Employees to Database"

the code works correctly but I want the binding to be within a if statement so the user has to fill out all the fields in form in order to progress further-therefore halt button binding.

Can anyone give me any pointers?
Posted
Comments
Sergey Alexandrovich Kryukov 8-Apr-13 18:20pm    
What's "xamle.exe"? Do you mean that your are looking how to bind the button in code? What are you trying to achieve, exactly?
—SA
Member 9611735 8-Apr-13 18:26pm    
i'm trying to bind the button in code. I am writing a if statement where if the user fill in all fields in the form and clicks the button-the page changes. If the user doesn't fill in all the fields a error appears and the page doesn't chage
Sergey Alexandrovich Kryukov 8-Apr-13 18:41pm    
Keep the form disabled until some data is not entered. Don't modify the handler method. Add a handler to the invocation list of the button's Click event (+=). That's it.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900