Grid x:Name="LayoutRoot" Background="White" Height="476" Width="698"
Grid.ColumnDefinitions> //Grid columns
ColumnDefinition Width="198" />
ColumnDefinition Width="212" />
ColumnDefinition Width="199">
ColumnDefinition Width="66*" />
Grid.ColumnDefinitions>
Grid.RowDefinitions> //Grid Rows
RowDefinition Height="32">
RowDefinition Height="36">
RowDefinition Height="150">
RowDefinition Height="15">
RowDefinition Height="39" />
RowDefinition Height="28" />
RowDefinition Height="176*" />
Grid.RowDefinitions
sdk:DatePicker Height="23" HorizontalAlignment="Left" Name="FromDatePicker" VerticalAlignment="Top" Width="120" Grid.Row="1" Margin="78,8,0,0" />
sdk:DatePicker Height="23" HorizontalAlignment="Left" Name="ToDatePicker" VerticalAlignment="Top" Width="120" Grid.Column="1" Grid.Row="1" Margin="77,8,0,0" />
Button Content="View" Height="23" HorizontalAlignment="Left" Name="btnView" VerticalAlignment="Top" Width="75" Grid.Column="2" Grid.Row="1" Margin="50,6,0,0" Click="btnView_Click" />
sdk:DataGrid AutoGenerateColumns="False" Grid.ColumnSpan="3" Grid.Row="2" Height="138" HorizontalAlignment="Center" Name="dgrVisitedContents" VerticalAlignment="Top" Width="555" Margin="33,1,21,0" Grid.RowSpan="2" IsReadOnly="True">
sdk:DataGrid.Columns>
sdk:DataGridTextColumn Binding="{Binding ChannelName}" Header="Channel Name" Width="200"> // binding public proprties of the public class
sdk:DataGridTextColumn Binding="{Binding ContentName}" Header="Content Name" Width="200"/>
sdk:DataGridTextColumn Binding="{Binding LastVisitedDate}" Header="Last Visited Date" Width="200" />
sdk:DataGrid.Columns>
/sdk:DataGrid>
sdk:Label Height="28" HorizontalAlignment="Left" Margin="12,8,0,0" Name="lblLabelFrom" VerticalAlignment="Top" Width="61" Content="From Date" Grid.Row="1" />
sdk:Label Grid.Column="1" Height="21" HorizontalAlignment="Left" Margin="9,10,0,0" Name="lblTo" VerticalAlignment="Top" Width="62" Content="To Date" Grid.Row="1" />
StackPanel Name="StackPanelHeader" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="183,-2,0,48" Grid.RowSpan="2">
Border Background="AliceBlue" Grid.ColumnSpan="4" Height="31" HorizontalAlignment="Left" VerticalAlignment="Top" Width="610">
dataInput:Label Height="25" HorizontalAlignment="Left" Name="lblHeader" VerticalAlignment="Center" Width="140" FontWeight="Normal" Content="Visited Contents" FontSize="16" HorizontalContentAlignment="Left" Grid.ColumnSpan="2" Margin="12,5,0,0" />
/Border>
XAML.cs
ObservableCollection
private BackgroundWorker bw = new BackgroundWorker();//Global
bw.DoWork += new DoWorkEventHandler(bw_DoWork);//MainPage
bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
if (bw.IsBusy != true)
{
bw.RunWorkerAsync();
}
void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
dgrVisitedContents.ItemsSource = hitspersonalise;
}
private void bw_DoWork(object sender, DoWorkEventArgs e)
{
//your code here to fire query and bind ListItemCollections using foreach to observation collection
hitspersonalise.Add(new HitsInfo()
{
ChannelName = Convert.ToString(_channelNameItem["ChannelName"]),
ContentName = Convert.ToString(_contentNameItem["ContentName"]),
LastVisitedDate = Convert.ToDateTime(item["Date"]).ToString("M/dd/yyyy"),
});
}
public class HitsInfo
{
#region public properties
public string ChannelName { get; set; }
public string ContentName { get; set; }
public string LastVisitedDate { get; set; }
#endregion
}
No comments:
Post a Comment