本文整理汇总了C#中System.Windows.Controls.GridViewColumnHeader类的典型用法代码示例。如果您正苦于以下问题:C# GridViewColumnHeader类的具体用法?C# GridViewColumnHeader怎么用?C# GridViewColumnHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GridViewColumnHeader类属于System.Windows.Controls命名空间,在下文中一共展示了GridViewColumnHeader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SortGlyphAdorner
/// <summary>
/// Initializes a new instance of the <see cref="SortGlyphAdorner"/> class.
/// </summary>
/// <param name="columnHeader">The column header</param>
/// <param name="direction">The direction</param>
/// <param name="sortGlyph">The image glyph</param>
public SortGlyphAdorner(GridViewColumnHeader columnHeader, ListSortDirection direction, ImageSource sortGlyph)
: base(columnHeader)
{
this.columnHeader = columnHeader;
this.direction = direction;
this.sortGlyph = sortGlyph;
}
开发者ID:modulexcite,项目名称:shelvesetcomparer,代码行数:13,代码来源:SortGlyphAdorner.cs
示例2: ListViewColumnHeader_Click
private void ListViewColumnHeader_Click(Object sender, RoutedEventArgs e)
{
using (listviewIssues.Items.DeferRefresh())
{
GridViewColumnHeader column = (GridViewColumnHeader)sender;
string sortBy = column.Tag.ToString();
if (listviewSortCol != null)
{
AdornerLayer.GetAdornerLayer(listviewSortCol).Remove(listviewSortAdorner);
listviewIssues.Items.SortDescriptions.Clear();
}
ListSortDirection newDir = ListSortDirection.Ascending;
if (column.Equals(listviewSortCol) && listviewSortAdorner.Direction == newDir)
{
newDir = ListSortDirection.Descending;
}
listviewSortCol = column;
listviewSortAdorner = new SortAdorner(listviewSortCol, newDir);
AdornerLayer.GetAdornerLayer(listviewSortCol).Add(listviewSortAdorner);
listviewIssues.Items.SortDescriptions.Add(new SortDescription(sortBy, newDir));
}
}
开发者ID:RSchwoerer,项目名称:BugTracker,代码行数:25,代码来源:TabAllIssuesView.xaml.cs
示例3: InnerListColumn
/// <summary>
/// Initializes a new instance of <see cref="InnerListColumn"/> class with the specified data description and visibility.
/// </summary>
/// <param name="dataDescription">The description of the data this column is bound to.</param>
/// <param name="isVisible">Whether the column is initially visible.</param>
/// <param name="createDefaultBinding">Whether the column should create a default binding using the specified data's property.</param>
public InnerListColumn(UIPropertyGroupDescription dataDescription, bool isVisible, bool createDefaultBinding)
{
if (dataDescription == null)
{
throw new ArgumentNullException("dataDescription");
}
GridViewColumnHeader header = new GridViewColumnHeader();
header.Content = dataDescription.DisplayContent;
header.DataContext = this;
Binding automationNameBinding = new Binding("DataDescription.DisplayName");
automationNameBinding.Source = this;
header.SetBinding(AutomationProperties.NameProperty, automationNameBinding);
this.Visible = isVisible;
this.Header = header;
this.DataDescription = dataDescription;
if (createDefaultBinding)
{
var defaultBinding = new Binding(GraphicalHostReflectionWrapper.EscapeBinding(dataDescription.PropertyName));
defaultBinding.StringFormat = GetDefaultStringFormat(dataDescription.DataType);
defaultBinding.ConverterCulture = CultureInfo.CurrentCulture;
this.DisplayMemberBinding = defaultBinding;
}
}
开发者ID:40a,项目名称:PowerShell,代码行数:34,代码来源:innerlistcolumn.cs
示例4: DefaultDirection
public ListSortDirection DefaultDirection(GridViewColumnHeader header)
{
var headerText = header.Content.ToString();
if (descendingHeaders.Contains(headerText))
{
return ListSortDirection.Descending;
}
return ListSortDirection.Ascending;
}
开发者ID:Jamedjo,项目名称:Raticon,代码行数:9,代码来源:ListViewSorter.cs
示例5: GetListCollectionViewFromGridViewColumnHeader
private static ListCollectionView GetListCollectionViewFromGridViewColumnHeader(GridViewColumnHeader header)
{
DependencyObject p = VisualTreeHelper.GetParent(header);
while (!(p is ListView))
{
p = VisualTreeHelper.GetParent(p);
}
return (ListCollectionView)CollectionViewSource.GetDefaultView(((ListView)p).ItemsSource);
}
开发者ID:EFanZh,项目名称:EFanZh,代码行数:11,代码来源:App.xaml.cs
示例6: getDirection
private ListSortDirection getDirection(GridViewColumnHeader headerClicked)
{
if (headerClicked == _lastHeaderClicked)
{
//Reverse direction
return (_lastDirection == ListSortDirection.Ascending) ? ListSortDirection.Descending : ListSortDirection.Ascending;
}
else
{
return ListSortDirection.Ascending;
}
}
开发者ID:InevitableHimes,项目名称:RSTabExplorer,代码行数:12,代码来源:TrackListing.xaml.cs
示例7: ListViewColumnHeader_Click
private void ListViewColumnHeader_Click(object sender, RoutedEventArgs e)
{
var headerClicked = e.OriginalSource as GridViewColumnHeader;
ListSortDirection direction;
if (headerClicked != null)
{
if (headerClicked.Role != GridViewColumnHeaderRole.Padding)
{
var headerTag = ((TextBlock)headerClicked.Content).Tag;
if (headerClicked != this.lastHeaderClicked)
{
direction = ListSortDirection.Ascending;
}
else
{
if (this.lastDirection == ListSortDirection.Ascending)
{
direction = ListSortDirection.Descending;
}
else
{
direction = ListSortDirection.Ascending;
}
}
this.Sort(headerTag.ToString(), direction);
if (direction == ListSortDirection.Ascending)
{
headerClicked.Column.HeaderTemplate = Resources["HeaderTemplateArrowUp"] as DataTemplate;
}
else
{
headerClicked.Column.HeaderTemplate = Resources["HeaderTemplateArrowDown"] as DataTemplate;
}
// Remove arrow from previously sorted header
if (this.lastHeaderClicked != null && this.lastHeaderClicked != headerClicked)
{
this.lastHeaderClicked.Column.HeaderTemplate = null;
}
this.lastHeaderClicked = headerClicked;
this.lastDirection = direction;
}
}
}
开发者ID:reecebedding,项目名称:gw2pao,代码行数:49,代码来源:DungeonSettingsView.xaml.cs
示例8: ItemsListViewHeader_Click
private void ItemsListViewHeader_Click(object sender, RoutedEventArgs e)
{
GridViewColumnHeader column = (sender as GridViewColumnHeader);
ListSortDirection direction = ListSortDirection.Ascending;
if (column == _lastColumn && direction == _lastDirection)
{
direction = ListSortDirection.Descending;
}
ItemsListView.Items.SortDescriptions.Clear();
ItemsListView.Items.SortDescriptions.Add(new SortDescription((string)column.Content, direction));
_lastColumn = column;
_lastDirection = direction;
}
开发者ID:Rympex,项目名称:proshine,代码行数:16,代码来源:InventoryView.xaml.cs
示例9: GridViewColumnHeaderClickedHandler
void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
{
if (e != null)
{
GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;
ListSortDirection direction;
if (headerClicked != null)
{
if (headerClicked.Role != GridViewColumnHeaderRole.Padding)
{
if (headerClicked != _lastHeaderClicked)
{
direction = ListSortDirection.Ascending;
}
else
{
if (_lastDirection == ListSortDirection.Ascending)
{
direction = ListSortDirection.Descending;
}
else
{
direction = ListSortDirection.Ascending;
}
}
string header = headerClicked.Column.Header as string;
int index = 0;
while ((string)UploadListViewGridView.Columns[index].Header != header) index++;
Sort(index, direction);
_lastHeaderClicked = headerClicked;
_lastDirection = direction;
}
}
}
else if (e == null && _lastHeaderClicked != null)
{
string header = _lastHeaderClicked.Column.Header as string;
int index = 0;
while ((string)UploadListViewGridView.Columns[index].Header != header) index++;
Sort(index, _lastDirection);
}
}
开发者ID:asapo,项目名称:Profes,代码行数:47,代码来源:FileShareUploadControl.xaml.cs
示例10: Sort
public void Sort(ListView listView, GridViewColumnHeader sortColumn)
{
String field = sortColumn.Tag as String;
if (_currentSortCol != null)
{
AdornerLayer.GetAdornerLayer(_currentSortCol).Remove(_sortAdorner);
listView.Items.SortDescriptions.Clear();
}
ListSortDirection newDir = ListSortDirection.Ascending;
if (_currentSortCol == sortColumn && _sortAdorner.Direction == newDir)
newDir = ListSortDirection.Descending;
_currentSortCol = sortColumn;
_sortAdorner = new SortAdorner(_currentSortCol, newDir);
AdornerLayer.GetAdornerLayer(_currentSortCol).Add(_sortAdorner);
listView.Items.SortDescriptions.Add(new SortDescription(field, newDir));
}
开发者ID:DanielSundberg,项目名称:FolderLounge,代码行数:19,代码来源:ListViewSorter.cs
示例11: SortClick
private void SortClick(object sender, RoutedEventArgs e)
{
var column = sender as GridViewColumnHeader;
var propertyName = column.Tag as string;
if (_curSortCol != null) {
AdornerLayer.GetAdornerLayer(_curSortCol).Remove(_curAdorner);
_listView.Items.SortDescriptions.Clear();
}
ListSortDirection direction = ListSortDirection.Ascending;
if (_curSortCol == column && _curAdorner.Direction == direction) {
direction = ListSortDirection.Descending;
}
_curSortCol = column;
_curAdorner = new SortAdorner(_curSortCol, direction);
AdornerLayer.GetAdornerLayer(_curSortCol).Add(_curAdorner);
_listView.Items.SortDescriptions.Add(new SortDescription(propertyName, direction));
}
开发者ID:liuxr,项目名称:wpfumprototype,代码行数:21,代码来源:UserListView.xaml.cs
示例12: SortClick
private void SortClick(object sender, RoutedEventArgs e)
{
GridViewColumnHeader column = sender as GridViewColumnHeader;
String field = column.Tag as String;
if (_CurSortCol != null)
{
AdornerLayer.GetAdornerLayer(_CurSortCol).Remove(_CurAdorner);
NetworkList.Items.SortDescriptions.Clear();
}
ListSortDirection newDir = ListSortDirection.Ascending;
if (_CurSortCol == column && _CurAdorner.Direction == newDir)
newDir = ListSortDirection.Descending;
_CurSortCol = column;
_CurAdorner = new SortAdorner(_CurSortCol, newDir);
AdornerLayer.GetAdornerLayer(_CurSortCol).Add(_CurAdorner);
NetworkList.Items.SortDescriptions.Add(
new SortDescription(field, newDir));
}
开发者ID:schwarz,项目名称:handle,代码行数:21,代码来源:NetworkSelectionView.xaml.cs
示例13: SortClick
private void SortClick(object sender, RoutedEventArgs e)
{
ViewModel.MainViewModel vm = DataContext as ViewModel.MainViewModel;
GridViewColumnHeader column = sender as GridViewColumnHeader;
String field = column.Tag as String;
if (m_current_sort_column != null)
{
AdornerLayer.GetAdornerLayer(m_current_sort_column).Remove(_CurAdorner);
m_entrylist.Items.SortDescriptions.Clear();
}
ListSortDirection newDir = ListSortDirection.Ascending;
if (m_current_sort_column == column && _CurAdorner.Direction == newDir)
newDir = ListSortDirection.Descending;
m_current_sort_column = column;
_CurAdorner = new SortAdorner(m_current_sort_column, newDir);
AdornerLayer.GetAdornerLayer(m_current_sort_column).Add(_CurAdorner);
m_entrylist.Items.SortDescriptions.Add(new SortDescription(field, newDir));
}
开发者ID:sbaer,项目名称:forumclient,代码行数:21,代码来源:MainWindow.xaml.cs
示例14: GridViewColumnHeaderClickedHandler
private void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
{
GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;
ListSortDirection direction;
if (headerClicked != null &&
headerClicked.Role != GridViewColumnHeaderRole.Padding)
{
if (headerClicked != _lastHeaderClicked)
{
direction = ListSortDirection.Ascending;
}
else
{
if (_lastDirection == ListSortDirection.Ascending)
{
direction = ListSortDirection.Descending;
}
else
{
direction = ListSortDirection.Ascending;
}
}
// see if we have an attached SortPropertyName value
string sortBy = GetSortPropertyName(headerClicked.Column);
if (string.IsNullOrEmpty(sortBy))
{
// otherwise use the column header name
sortBy = headerClicked.Column.Header as string;
}
Sort(sortBy, direction);
_lastHeaderClicked = headerClicked;
_lastDirection = direction;
}
}
开发者ID:JoshuaWeber,项目名称:HockeyApp-for-Windows,代码行数:37,代码来源:SortableListView.cs
示例15: GridViewColumnHeaderClickedHandler
private static void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
{
var headerClicked = e.OriginalSource as GridViewColumnHeader;
if (headerClicked != null)
{
ListSortDirection direction;
if (!Equals(headerClicked, _lastHeaderClicked))
{
direction = ListSortDirection.Ascending;
}
else
{
direction = _lastDirection == ListSortDirection.Ascending ? ListSortDirection.Descending : ListSortDirection.Ascending;
}
string header = String.Empty;
try
{
header = ((Binding)GetSortBindingMember(headerClicked.Column)).Path.Path;
}
catch (Exception)
{
}
if (header == String.Empty)
return;
Sort(header, direction);
string resourceTypeName = String.Empty;
//if (_lastHeaderClicked != null)
//{
// ResourceTypeName = "HeaderTemplateSortNon";
// tmpTemplate = lv.TryFindResource(ResourceTypeName) as DataTemplate;
// _lastHeaderClicked.Column.HeaderTemplate = tmpTemplate;
//}
switch (direction)
{
case ListSortDirection.Ascending: resourceTypeName = "HeaderTemplateSortAsc"; break;
case ListSortDirection.Descending: resourceTypeName = "HeaderTemplateSortDesc"; break;
}
var tmpTemplate = _lv.TryFindResource(resourceTypeName) as DataTemplate;
if (tmpTemplate != null)
{
headerClicked.Column.HeaderTemplate = tmpTemplate;
}
_lastHeaderClicked = headerClicked;
_lastDirection = direction;
}
}
开发者ID:neapolis,项目名称:SambaPOS-3,代码行数:63,代码来源:ListViewSorter.cs
示例16: SortClickHandler
void SortClickHandler(object sender, RoutedEventArgs e)
{
GridViewColumnHeader headerClicked = (GridViewColumnHeader)e.OriginalSource;
if (headerClicked == null || headerClicked.Role == GridViewColumnHeaderRole.Padding)
{
return;
}
ListSortDirection direction = getDirection(headerClicked);
Sort((string)headerClicked.Tag, direction);
headerClicked.Column.HeaderTemplate = getArrow(direction);
// Remove arrow from previously sorted header
if (_lastHeaderClicked != null && _lastHeaderClicked != headerClicked)
{
_lastHeaderClicked.Column.HeaderTemplate = null;
}
_lastHeaderClicked = headerClicked;
_lastDirection = direction;
}
开发者ID:InevitableHimes,项目名称:RSTabExplorer,代码行数:24,代码来源:TrackListing.xaml.cs
示例17: Sort
private void Sort(GridViewColumnHeader headerClicked)
{
ListSortDirection direction = getDirection(headerClicked);
SortData((string)headerClicked.Tag, direction);
SetArrow(headerClicked, direction);
_lastHeaderClicked = headerClicked;
_lastDirection = direction;
}
开发者ID:Jamedjo,项目名称:Raticon,代码行数:9,代码来源:ListViewSorter.cs
示例18: GridViewContactColumnHeader_Click
// contact sorting
private void GridViewContactColumnHeader_Click(object sender, RoutedEventArgs e)
{
GridViewColumnHeader column = (sender as GridViewColumnHeader);
contactSortBy = column.Tag.ToString();
if (listViewContactSortCol != null)
{
AdornerLayer.GetAdornerLayer(listViewContactSortCol).Remove(listViewContactSortAdorner);
listview_contacts.Items.SortDescriptions.Clear();
}
ListSortDirection newDir = ListSortDirection.Ascending;
if (listViewContactSortCol == column && listViewContactSortAdorner.Direction == newDir)
newDir = ListSortDirection.Descending;
listViewContactSortCol = column;
listViewContactSortAdorner = new SortAdorner(listViewContactSortCol, newDir);
AdornerLayer.GetAdornerLayer(listViewContactSortCol).Add(listViewContactSortAdorner);
listview_contacts.Items.SortDescriptions.Add(new SortDescription(contactSortBy, newDir));
}
开发者ID:thongvo,项目名称:myfiles,代码行数:21,代码来源:Page_LocalGroups.xaml.cs
示例19: GridViewColumnHeaderClickedHandler
private void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
{
GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;
ListSortDirection direction = ListSortDirection.Ascending;
if (headerClicked != null)
{
if (headerClicked.Role != GridViewColumnHeaderRole.Padding)
{
if (headerClicked == lastHeaderClicked)
{
direction = lastDirection == ListSortDirection.Ascending ? ListSortDirection.Descending : ListSortDirection.Ascending;
}
}
string header = headerClicked.Column.Header as string;
PropertyId id = (PropertyId)Enum.Parse(typeof(PropertyId), header);
cache.SortCache(id, direction);
lstCustomers.Items.Clear();
foreach (CustomerAdminObject customer in cache)
{
ListViewItem item = new ListViewItem();
item.Content = customer;
//item.MouseDoubleClick += item_MouseDoubleClick;
//item.KeyDown += item_KeyDown;
lstCustomers.Items.Add(item);
}
if (lastHeaderClicked != null && lastHeaderClicked != headerClicked)
{
lastHeaderClicked.Column.HeaderTemplate = null;
}
lastHeaderClicked = headerClicked;
lastDirection = direction;
}
}
开发者ID:rogertoma,项目名称:CarDepot,代码行数:41,代码来源:CustomerSearchControl.xaml.cs
示例20: GridViewColumnHeaderClickedHandler
private void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
{
GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;
ListSortDirection direction;
if (headerClicked != null) {
if (headerClicked.Role != GridViewColumnHeaderRole.Padding) {
if (headerClicked != _lastHeaderClicked) {
direction = ListSortDirection.Ascending;
} else {
if (_lastDirection == ListSortDirection.Ascending) {
direction = ListSortDirection.Descending;
} else {
direction = ListSortDirection.Ascending;
}
}
TextBlock b = headerClicked.Content as TextBlock;
Sort(b.Tag as DisplayColumnDefinition, direction);
if (direction == ListSortDirection.Ascending) {
headerClicked.Column.HeaderTemplate = Resources["HeaderTemplateArrowUp"] as DataTemplate;
} else {
headerClicked.Column.HeaderTemplate = Resources["HeaderTemplateArrowDown"] as DataTemplate;
}
// Remove arrow from previously sorted header
if (_lastHeaderClicked != null && _lastHeaderClicked != headerClicked) {
_lastHeaderClicked.Column.HeaderTemplate = null;
}
_lastHeaderClicked = headerClicked;
_lastDirection = direction;
}
}
}
开发者ID:kehh,项目名称:biolink,代码行数:36,代码来源:TabularDataViewer.xaml.cs
注:本文中的System.Windows.Controls.GridViewColumnHeader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论