本文整理汇总了C#中System.Windows.Data.PagedCollectionView类的典型用法代码示例。如果您正苦于以下问题:C# PagedCollectionView类的具体用法?C# PagedCollectionView怎么用?C# PagedCollectionView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PagedCollectionView类属于System.Windows.Data命名空间,在下文中一共展示了PagedCollectionView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: mc_srv_select_RDCompleted
void mc_srv_select_RDCompleted(object sender, srv_select_RDCompletedEventArgs e)
{
if (e.Result != null)
{
if (e.Result.Count > 0)
{
PagedCollectionView c1 = new PagedCollectionView(e.Result);
//c1.GroupDescriptions.Add(new PropertyGroupDescription(""));
listRD = new List<RD_ex>();
string name = e.Result[0].Contractor_Name;
RD_ex R = new RD_ex(name);
foreach (cRD item in c1)
{
if (name != item.Contractor_Name)
{
listRD.Add(R);
name = item.Contractor_Name;
R = new RD_ex(name);
}
R.addItem(item.MassType, item.Sort_Name, item.Val.ToString());
}
dgCol = new PagedCollectionView(GenerateDataB().ToDataSource());
dg_B.ItemsSource = dgCol;
//dg_F.ItemsSource = GenerateDataF().ToDataSource();
}
}
}
示例2: BindDataGrid
private void BindDataGrid(List<V_RoleUserInfo> obj)
{
PagedCollectionView pcv = null;
if (obj == null || obj.Count < 1)
{
//HtmlPage.Window.Alert("对不起!未能找到相关记录。");
DtGridUsers.ItemsSource = null;
return;
}
var q = from ent in obj
select ent;
//按公司部门排序
q = q.OrderBy(s=>s.COMPANYNAME).OrderBy(s=>s.DEPARTMENTNAME);
pcv = new PagedCollectionView(q);
pcv.PageSize = 500;
DtGridUsers.ItemsSource = pcv;
//if (e.Result != null)
//{
// List<T_SYS_ROLE> menulist = e.Result.ToList();
// var q = from ent in menulist
// select ent;
// pcv = new PagedCollectionView(q);
// pcv.PageSize = 100;
//}
//DtGrid.ItemsSource = pcv;
//DtGridUsers.CacheMode = new BitmapCache();
}
示例3: client_GetLogsCompleted
void client_GetLogsCompleted(object sender, GetLogsCompletedEventArgs e)
{
Dispatcher.BeginInvoke(() =>
{
var taskListView = new PagedCollectionView(e.Result);
if (taskListView.CanGroup)
{
if (cbGroupByIndend.IsChecked.HasValue && cbGroupByIndend.IsChecked.Value)
{
var group = new PropertyGroupDescription();
group.PropertyName = "IndentLevel";
taskListView.GroupDescriptions.Add(group);
}
if (cbGroupByMessage.IsChecked.HasValue && cbGroupByMessage.IsChecked.Value)
{
var group = new PropertyGroupDescription();
group.PropertyName = "Message";
taskListView.GroupDescriptions.Add(group);
}
}
logEntryEventArgsDataGrid.ItemsSource = taskListView;
if(!string.IsNullOrWhiteSpace(searchBox.txtSearchCriteria.Text))
{
SearchBox_Search(null, new SearchCriteriaEventArgs(searchBox.txtSearchCriteria.Text));
}
waitCursor.IsWaitEnable = false;
});
}
示例4: BindData
void BindData(IEnumerable<Measurement> measurementList)
{
PagedCollectionView pagedList = new PagedCollectionView(measurementList);
ListBoxMeasurementList.ItemsSource = pagedList;
DataPagerMeasurements.Source = pagedList;
ListBoxMeasurementList.SelectedIndex = -1;
}
示例5: LayoutRoot_Loaded
private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
{
PagedCollectionView pcv = new PagedCollectionView(dataContext);
pcv.PageSize = 10;
this.DataContext = pcv;
this.searchSalesData.ItemsSource = dataContext.Select(a => a.SalesPerson);
double minSalesAmout = dataContext.Min(a => a.SalesAmount);
double maxSalesAmount = dataContext.Max(a => a.SalesAmount);
double salesAmountDelta = maxSalesAmount - minSalesAmout;
double minFontSize = 10.0;
double maxFontSize = 30.0;
double fontSizeDelta = maxFontSize - minFontSize;
for (int i = 0; i < dataContext.Count; i++)
{
TextBlock textBlock = new TextBlock
{
Text = dataContext[i].CompanyName,
Foreground = i % 2 == 0 ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Blue),
Margin = new Thickness(2),
FontSize = minFontSize + dataContext[i].SalesAmount * fontSizeDelta / salesAmountDelta
};
this.wrapPanelSales.Children.Add(textBlock);
}
}
示例6: DataGridGrouping
public DataGridGrouping()
{
InitializeComponent();
// Create a collection to store task data.
ObservableCollection<Task> taskList = new ObservableCollection<Task>();
// Generate some task data and add it to the task list.
for (int i = 1; i <= 14; i++)
{
taskList.Add(new Task()
{
ProjectName = "Project " + ((i % 3) + 1).ToString(),
TaskName = "Task " + i.ToString(),
DueDate = DateTime.Now.AddDays(i),
Complete = (i % 2 == 0),
Notes = "Task " + i.ToString() + " is due on "
+ DateTime.Now.AddDays(i) + ". Lorum ipsum..."
});
}
PagedCollectionView taskListView = new PagedCollectionView(taskList);
this.dataGrid1.ItemsSource = taskListView;
if (taskListView.CanGroup == true)
{
// Group tasks by ProjectName...
taskListView.GroupDescriptions.Add(new PropertyGroupDescription("ProjectName"));
// Then group by Complete status.
taskListView.GroupDescriptions.Add(new PropertyGroupDescription("Complete"));
}
if (taskListView.CanSort == true)
{
// By default, sort by ProjectName.
taskListView.SortDescriptions.Add(new SortDescription("ProjectName", ListSortDirection.Ascending));
}
}
示例7: ToPrintFriendlyGrid
public static DataGrid ToPrintFriendlyGrid(this DataGrid source,PagedCollectionView pcv)
{
DataGrid dg = new DataGrid();
dg.ItemsSource = pcv;
dg.AutoGenerateColumns = false;
for (int i = 0; i < source.Columns.Count; i++)
{
DataGridTextColumn newColumn = new DataGridTextColumn();
DataGridTextColumn column = (DataGridTextColumn)source.Columns[i];
newColumn.Header = column.Header;
System.Windows.Data.Binding bind;
if (column.Binding != null)
{
bind = new System.Windows.Data.Binding();
bind.Path = column.Binding.Path;
//bind.Converter = column.Binding.Converter;
}
else
bind = new System.Windows.Data.Binding();
newColumn.Binding = bind;
dg.Columns.Add(newColumn);
}
return dg;
}
示例8: ChatViewModel
public ChatViewModel(IChatService chatService)
{
this.contacts = new ObservableCollection<Contact>();
this.contactsView = new PagedCollectionView(this.contacts);
this.sendMessageRequest = new InteractionRequest<SendMessageViewModel>();
this.showReceivedMessageRequest = new InteractionRequest<ReceivedMessage>();
this.showDetailsCommand = new ShowDetailsCommandImplementation(this);
this.contactsView.CurrentChanged += this.OnCurrentContactChanged;
this.chatService = chatService;
this.chatService.Connected = true;
this.chatService.ConnectionStatusChanged += (s, e) => this.RaisePropertyChanged(() => this.ConnectionStatus);
this.chatService.MessageReceived += this.OnMessageReceived;
this.chatService.GetContacts(
result =>
{
if (result.Error == null)
{
foreach (var item in result.Result)
{
this.contacts.Add(item);
}
}
});
}
示例9: wc_ws_selectNextCalibrationsCompleted
void wc_ws_selectNextCalibrationsCompleted(object sender, ws_selectNextCalibrationsCompletedEventArgs e)
{
if (e.Result != null)
{
c_collection_next = new PagedCollectionView(e.Result);
IEnumerable<wsCalibration> next = from item in e.Result where item.plannedDate > DateTime.Now select item;
IEnumerable<wsCalibration> missed = from item in e.Result where item.plannedDate <= DateTime.Now select item;
IEnumerable<wsCalibration> not = from item in e.Result where item.plannedDate == null select item;
c_collection_next = new PagedCollectionView(next);
c_collection_missed = new PagedCollectionView(missed);
c_collection_not = new PagedCollectionView(not);
dg_NextWeek.ItemsSource = c_collection_next;
dg_Missed.ItemsSource = c_collection_missed;
dg_Not.ItemsSource = c_collection_not;
txt_nextCaption.Text = "Период поверки устройств истекает в ближайшую неделю (список на дату: "+ DateTime.Now.Date + ")";
txt_missedCaption.Text = "Поверка просрочена (список на дату: " + DateTime.Now.Date + ")";
txt_notCaption.Text = "Отсутствуют сведения поверке (список на дату: " + DateTime.Now.Date + ")";
}
else
{
cwnd_ShitHappens w = new cwnd_ShitHappens(ErrorResources.err_SELECT, e.OpStatus.ToString());
w.Show();
}
}
示例10: DataPagerSample
/// <summary>
/// Initializes a DataPagerSample.
/// </summary>
public DataPagerSample()
{
InitializeComponent();
PagedCollectionView pcv = new PagedCollectionView(Airport.SampleAirports.ToArray());
pcv.PageSize = 6;
DataContext = pcv;
}
示例11: BindData
void BindData(IEnumerable<Device> deviceList)
{
m_pagedList = new PagedCollectionView(deviceList);
ListBoxDeviceList.ItemsSource = m_pagedList;
DataPagerDevices.Source = m_pagedList;
ListBoxDeviceList.SelectedIndex = -1;
}
示例12: QueryMagneticCard
//查詢磁卡資料
async void QueryMagneticCard()
{
//busyIndicator.IsBusy = true;
ObservableCollection<MagneticCard> objMagneticCard = new ObservableCollection<MagneticCard>();
var q = await db.LoadAsync<vwMagneticCard>(db.GetVwMagneticCardQuery());
foreach (var vwMagneticCardData in q)
{
objMagneticCard.Add(new MagneticCard
{
RoleID = vwMagneticCardData.RoleID??0,
ABA = vwMagneticCardData.ABA,
Name = vwMagneticCardData.Name,
Company = vwMagneticCardData.Company,
Memo = vwMagneticCardData.Memo
});
}
//分頁,但會選取DataGrid第一筆
pageView = new PagedCollectionView(q);
dataGrid.ItemsSource = pageView;
magneticCardData = objMagneticCard;
//busyIndicator.IsBusy = false;
}
示例13: PrintGrid
public static void PrintGrid(this DataGrid source,PagedCollectionView pcv)
{
var dg = source.ToPrintFriendlyGrid(pcv);
var doc = new PrintDocument();
var offsetY = 0d;
var totalHeight = 0d;
var canvas = new Canvas();
canvas.Children.Add(dg);
doc.PrintPage += (s, e) =>
{
e.PageVisual = canvas;
canvas.Margin = new Thickness(50);
if (totalHeight == 0)
{
totalHeight = dg.DesiredSize.Height;
}
Canvas.SetTop(dg, -offsetY);
offsetY += e.PrintableArea.Height;
e.HasMorePages = offsetY <= totalHeight;
};
doc.Print(null);
}
示例14: wc_ws_selectDeviceCalibrationsCompleted
void wc_ws_selectDeviceCalibrationsCompleted(object sender, ws_selectDeviceCalibrationsCompletedEventArgs e)
{
if (e.Result != null)
{
if (e.Result.Count > 0)
{
dg_Calibration.Visibility = Visibility.Visible;
no_Calibration.Visibility = Visibility.Collapsed;
PagedCollectionView collection = new PagedCollectionView(e.Result);
dg_Calibration.ItemsSource = collection;
}
else
{
dg_Calibration.Visibility = Visibility.Collapsed;
no_Calibration.Visibility = Visibility.Visible;
}
}
else
{
cwnd_ShitHappens w = new cwnd_ShitHappens(ErrorResources.err_SELECT, e.OpStatus.ToString());
w.Show();
}
}
示例15: MainPage_Loaded
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
IList<orderEntity> list = this.GetDataSource();
PagedCollectionView pcv = new PagedCollectionView(list);
pcv.PageSize = 10;
this.dataGrid1.ItemsSource = pcv;
this.dataPager1.DataContext = pcv;
}