i am trying to create a program that displays some information in a table format. The number of rows of this table can change and therefore the table may or may not be fully vieweable on one viewing of the webpage.
Is there a way where i can show parts of the table over time? For example: show rows 1-30 for 1 minute, then show rows 31-50 for 1 minute, and then back to rows 1-30 for another minute and so forth.
The code i have so far is:
XAML:
<Grid x:Name="LayoutRoot" Background="White"> <Grid.RowDefinitions> <RowDefinition Height="50"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid x:Name="InnerGrid" Grid.Row="1" Background="White"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> </Grid> </Grid>
using system; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Diagnostics; namespace MyNameSpace { public partial class MainPage : UserControl { //The value of numRows will depend on a value from a database, so it may change every once in a while. int numRows = 45; Border border = new Border(); Border border2 = new Border(); public MainPage() { InitializeComponent(); createRows(); } public Border initializeBorder(Border b) { b.BorderBrush = new SolidColorBrush(Colors.Black); b.BorderThickness = new Thickness(1); return b; } public void createRows() { //This for loop creates the necessary amount of rows. for (int i = 0; i < numRows; i++) { RowDefinition rd = new RowDefinition(); rd.Height = new GridLength(20); InnerGrid.RowDefinitions.Add(rd); } //This for loop creates and applies the borders that make the table "appear" for (int i = 0; i < numRows; i++) { Border b = new Border(); Border b2 = new Border(); Grid.SetColumn(initializeBorder(b), i); Grid.SetRow(initializeBorder(b2), i); Grid.SetColumnSpan(b, 11); Grid.SetColumnSpan(b2, 11); Grid.SetRowSpan(b, numRows); Grid.SetRowSpan(b2, numRows); InnerGrid.Children.Add(b); InnerGrid.Children.Add(b2); } } }
}
Answer: 1
Here is the simple sample to create datagrid from the service
Repeat the process:
Get the data from the service Parse the data Assign it as items source to the data grid
Use Disptacher Timer and after every minute or whatever time interval get the xml data from service, parse it and assign it to Datagrid.
by : Sajeetharanhttp://stackoverflow.com/users/1749403
1 comment:
Very great post. I simply stumbled upon your blog and
wished to mention that I have really enjoyed
surfing around your blog posts. After all I'll be subscribing for your rss feed and I hope you write once more very soon!
Here is my website electric toothbrush reviews
Post a Comment
Send us your comment related to the topic mentioned on the blog