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>