TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bob Jones
NA
2
720
Xamarin Forms Binding Source Question
Nov 27 2018 9:54 AM
Greetings - I am new to Xamarin Forms and am using C# as the backend. I am wanting to create a grid that has a switch grid (what I like to call a toggle button) and 5 fields. I need the data source of those 5 fields to be pulled from a sql server database.
I come from C# background so I am invisioning a datatable set-up that displays all rows that meet the criteria of my Select statement. I have come up with this XAML which meets what I need, however I do not know how to Bind my data to the textboxes.
Can someone here assist me?
<
ContentPage
xmlns
=
"http://xamarin.com/schemas/2014/forms"
xmlns:x
=
"http://schemas.microsoft.com/winfx/2009/xaml"
x:Class
=
"Test.Pages.TestApprove"
>
<
ContentPage.Content
>
<
StackLayout
>
<
Label
Text
=
"The users below are Requesting Access:"
>
</
Label
>
<
Grid
Padding
=
"5,0"
RowSpacing
=
"1"
ColumnSpacing
=
"1"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"auto"
/>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"auto"
/>
</
Grid.ColumnDefinitions
>
<
Switch
Grid.Row
=
"0"
Grid.Column
=
"0"
VerticalOptions
=
"Center"
HorizontalOptions
=
"Center"
BackgroundColor
=
"Brown"
/>
<
Label
Text
=
"{Binding fname}"
Grid.Row
=
"0"
Grid.Column
=
"1"
Grid.ColumnSpan
=
"1"
Margin
=
"1"
BackgroundColor
=
"Blue"
IsEnabled
=
"false"
/>
<
Entry
Text
=
"{Binding lname}"
Grid.Row
=
"0"
Grid.Column
=
"2"
Grid.ColumnSpan
=
"1"
Margin
=
"1"
IsEnabled
=
"false"
FontSize
=
"Small"
BackgroundColor
=
"Purple"
/>
<
Entry
Text
=
"{Binding company}"
Grid.Row
=
"0"
Grid.Column
=
"3"
Grid.ColumnSpan
=
"1"
Margin
=
"1"
FontSize
=
"Small"
BackgroundColor
=
"Green"
/>
<
Entry
Text
=
"{Binding Phone}"
Grid.Row
=
"0"
Grid.Column
=
"4"
Grid.ColumnSpan
=
"1"
Margin
=
"1"
FontSize
=
"Small"
BackgroundColor
=
"Orange"
/>
</
Grid
>
<
Button
Command
=
"{Binding ApproveUserCommand}"
Text
=
"Approve User"
TextColor
=
"White"
FontAttributes
=
"Bold"
FontSize
=
"Large"
HorizontalOptions
=
"FillAndExpand"
BackgroundColor
=
"#088da5"
/>
</
StackLayout
>
</
ContentPage.Content
>
</
ContentPage
>
Reply
Answers (
1
)
What’s the correct image format for the android application
Fatch Data from local Host Api in Xamarin Forms