I have this simple WPF window below, the textbox is bound to a StudentName column in a table called Students, in XAML. I'm using EntityFramework 5 for data access.
Now you see this window when you run it, how do I got about implementing the Next and Previous buttons? I have looked online and paging has been suggested, but isn't there a simple one-line way, similar to the oldschool way of moving the recordset to new row? I don't want to use a datagrid, I need to have a bunch of text boxes later-on on the screen with the ability to press next and previous for browsing.
Even if there isn't a one-line way ( and I don't think there is ) just how do I implement the Next and Previous functionality ?
Thank you :)
This is my codebehind
public LinqNext()
{
InitializeComponent();
SchoolEntities schoolEntities = new SchoolEntities();
MyGrid.DataContext = schoolEntities.Students.ToList();
}
private void NextButton_Click(object sender, RoutedEventArgs e)
{
//What do put here to move to next record
//(Note this code is obviously "MVVM-FREE"
//Right now i'd just like to move to next record
}
This is My XAML ( simplified)
<Grid x:Name="MyGrid">
<Button x:Name="NextButton" Content="Next" />
<Button x:Name="PreviousButton" Content="Previous"/>
<TextBox x:Name="StudentName" Text="{Binding Path=StudentName}" />
</Grid>