public SubmitListView() { SmartColumn path = new SmartColumn(this, "Path", 60, "Path"); SmartColumn project = new SmartColumn(this, "Project", 60, "Project"); SmartColumn change = new SmartColumn(this, "Change", 60, "Change"); SmartColumn fullPath = new SmartColumn(this, "Full Path", 60, "FullPath"); Columns.AddRange(new ColumnHeader[] { path, project, change, fullPath }); project.Groupable = true; path.Hideable = false; SortColumns.Add(path); GroupColumns.Add(project); FinalSortColumn = path; ShowSelectAllCheckBox = true; }
void Initialize() { SmartColumn path = new SmartColumn(this, PCResources.PathColumn, 288, "Path"); SmartColumn project = new SmartColumn(this, PCResources.ProjectColumn, 76, "Project"); SmartColumn conflictType = new SmartColumn(this, PCResources.ConflictTypeColumn, 92, "ConflictType"); SmartColumn conflictDescription = new SmartColumn(this, PCResources.ConflictDescriptionColumn, 288, "ConflictDescription"); SmartColumn change = new SmartColumn(this, PCResources.ChangeColumn, 76, "Change"); SmartColumn fullPath = new SmartColumn(this, PCResources.FullPathColumn, 327, "FullPath"); SmartColumn changeList = new SmartColumn(this, PCResources.ChangeListColumn, 76, "ChangeList"); SmartColumn folder = new SmartColumn(this, PCResources.FolderColumn, 196, "Folder"); SmartColumn locked = new SmartColumn(this, PCResources.LockedColumn, 38, "Locked"); SmartColumn modified = new SmartColumn(this, PCResources.ModifiedColumn, 76, "Modified"); SmartColumn name = new SmartColumn(this, PCResources.NameColumn, 76, "Name"); SmartColumn type = new SmartColumn(this, PCResources.TypeColumn, 76, "Type"); SmartColumn workingCopy = new SmartColumn(this, PCResources.WorkingCopyColumn, 76, "WorkingCopy"); Columns.AddRange(new ColumnHeader[] { path, project, conflictType, conflictDescription, }); modified.Sorter = new SortWrapper( delegate(ConflictListItem x, ConflictListItem y) { return(x.PendingChange.SvnItem.Modified.CompareTo(y.PendingChange.SvnItem.Modified)); }); change.Groupable = true; changeList.Groupable = true; folder.Groupable = true; locked.Groupable = true; project.Groupable = true; type.Groupable = true; workingCopy.Groupable = true; path.Hideable = false; AllColumns.Add(change); AllColumns.Add(changeList); AllColumns.Add(conflictType); AllColumns.Add(conflictDescription); AllColumns.Add(folder); AllColumns.Add(fullPath); AllColumns.Add(locked); AllColumns.Add(modified); AllColumns.Add(name); AllColumns.Add(path); AllColumns.Add(project); AllColumns.Add(type); AllColumns.Add(workingCopy); SortColumns.Add(path); FinalSortColumn = path; }
public AllProjectsViewModel(ProjectData projectData, TaskData taskData) { if (projectData == null) { throw new ArgumentNullException("projectData"); } base.DisplayName = Properties.Resources.Projects_DisplayName; base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/project.png"; _projectData = projectData; _taskData = taskData; // Subscribe for notifications of when a new project is saved. _projectData.ProjectAdded += this.OnProjectAdded; _projectData.ProjectUpdated += this.OnProjectUpdated; _projectData.ProjectDeleted += this.OnProjectDeleted; this.AllProjects = new ObservableCollection <ProjectViewModel>(); this.AllProjects.CollectionChanged += this.OnCollectionChanged; this.PageFirst(); SortColumns.Add(new SortableProperty() { Description = "Title", Name = "Title" }); SortColumns.Add(new SortableProperty() { Description = "Status", Name = "StatusId" }); SortColumns.Add(new SortableProperty() { Description = "Est. Cost", Name = "EstimatedCost" }); SortColumns.Add(new SortableProperty() { Description = "Goal", Name = "GoalTitle" }); SortColumns.Add(new SortableProperty() { Description = "Date Created", Name = "CreatedDate" }); SortColumns.Add(new SortableProperty() { Description = "Date Completed", Name = "CompletedDate" }); SelectedSortColumn = SortColumns.FirstOrDefault(); // select the first project ProjectViewModel firstProject = AllProjects.FirstOrDefault(); if (firstProject != null) { firstProject.IsSelected = true; } }
private void VisitSortExpression(KeyValuePair <string, Expression> sortExpression) { var visitor = new MemberExpressionVisitor(_context); visitor.Visit(sortExpression.Value); if (visitor.Token.Type != TokenType.Column) { throw new Exception(); } SortColumns.Add(new KeyValuePair <string, Column>(sortExpression.Key, visitor.Token.Column)); }
public void SetOrToggleSortColumn(string columnName) { if (SortColumns.ContainsKey(columnName)) { SortColumns[columnName] = SortColumns[columnName].Toggle(); } else { SortColumns.Clear(); SortColumns.Add(columnName, SortDirection.Ascending()); } }
void Init() { SmartColumn issueId = new SmartColumn(this, "&Issue Id", 100, "IssueId"); AllColumns.Add(issueId); Columns.AddRange( new ColumnHeader[] { issueId }); SortColumns.Add(issueId); FinalSortColumn = issueId; }
protected override void OnColumnClick(ColumnClickEventArgs e) { if (!DesignMode && View == View.Details && !VirtualMode) { ColumnHeader column = Columns[e.Column]; SmartColumn sc = column as SmartColumn; if (sc != null && sc.Sortable) { bool extend = (Control.ModifierKeys & Keys.Control) != 0; if (!extend) { if (SortColumns.Count == 1 && SortColumns[0] == sc) { sc.ReverseSort = !sc.ReverseSort; } else { SortColumns.Clear(); SortColumns.Add(sc); sc.ReverseSort = false; } } else { if (SortColumns.Contains(sc)) { sc.ReverseSort = !sc.ReverseSort; } else { sc.ReverseSort = false; SortColumns.Add(sc); } } Sort(); UpdateSortGlyphs(); } } base.OnColumnClick(e); }
/// <summary> /// Takes an order by string (i.e., FirstName DESC, ID) and /// converts it to sortcolumns /// </summary> /// <param name="orderBy">The order by.</param> public void ParseOrderBy(string orderBy) { if (orderBy == null) { return; } if (SortColumns == null) { SortColumns = new List <SearchSortColumn>(); } foreach (Match m in Regex.Matches(orderBy, RegularExpressions.OrderByParserRegex, RegexOptions.Compiled)) { var ss = new SearchSortColumn(); ss.Name = m.Groups[1].Value.Trim(); ss.IsDescending = m.Groups[2].Success; // then there's a count match, because DESC was matched SortColumns.Add(ss); } }
void Init() { SmartColumn action = new SmartColumn(this, "&Action", 60); SmartColumn path = new SmartColumn(this, "&Path", 342); SmartColumn copy = new SmartColumn(this, "&Copy", 60); SmartColumn copyRev = new SmartColumn(this, "Copy &Revision", 60); AllColumns.Add(action); AllColumns.Add(path); AllColumns.Add(copy); AllColumns.Add(copyRev); Columns.AddRange( new ColumnHeader[] { action, path, copy, copyRev }); SortColumns.Add(path); FinalSortColumn = path; }
private static DataGridColumn CreateColumn(DataGrid gridView, object columnSource) { DataGridTextColumn column = new DataGridTextColumn(); var info = columnSource as DataGridColumnInfoM; if (!string.IsNullOrEmpty(info.Header)) { column.Header = info.Header; } if(!string.IsNullOrEmpty(info.Binding)) { column.Binding = new Binding(info.Binding); } if(!string.IsNullOrEmpty(info.HorizontalContentAlignment)) { //column.ElementStyle = new Binding(info.HorizontalContentAlignment); Style right = new Style(typeof(TextBlock)); Setter setRight = new Setter(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Right); right.Setters.Add(setRight); setRight = new Setter(TextBlock.MarginProperty, new Thickness(5,0,5,0)); right.Setters.Add(setRight); column.ElementStyle = right; } if (info.Width > 0) { column.Width = info.Width; } return column; #if false DataTemplate template = new DataTemplate(); FrameworkElementFactory factory = new FrameworkElementFactory(typeof(TextBlock)); factory.SetValue(TextBlock.HorizontalAlignmentProperty, info.HorizontalAlignment); if (info.Foreground != null) { factory.SetValue(TextBlock.ForegroundProperty, info.Foreground); } if (info.ForegroundTriggerParameters != null && !string.IsNullOrEmpty(info.ForegroundMemberPath)) { foreach (var o in info.ForegroundTriggerParameters) { var trigger = new DataTrigger(); trigger.Binding = new Binding(info.ForegroundMemberPath); trigger.Value = o.Key; var setter = new Setter(); setter.Property = TextBlock.ForegroundProperty; setter.Value = o.Value; trigger.Setters.Add(setter); template.Triggers.Add(trigger); } } var binding = new Binding(info.DisplayMemberPath); if (!string.IsNullOrEmpty(info.StringFormat)) { binding.StringFormat = string.Format("{{0:{0}}}", info.StringFormat); } if (info.Converter != null) { binding.Converter = info.Converter; binding.ConverterParameter = info.ConverterParameter; } factory.SetBinding(TextBlock.TextProperty, binding); template.VisualTree = factory; column.CellTemplate = template; ListViewItemSortData scd = new ListViewItemSortData(info.DisplayMemberPath); scd.Direction = info.SortDirection; if (SortColumns.Count(c => c.Key == column) == 0) { SortColumns.Add(column, scd); } else { Console.WriteLine("Repeat SortColumns.................."); } return column; #endif }
public void Initialize() { SmartColumn path = new SmartColumn(this, PCResources.PathColumn, 288, "Path"); SmartColumn project = new SmartColumn(this, PCResources.ProjectColumn, 76, "Project"); SmartColumn change = new SmartColumn(this, PCResources.ChangeColumn, 76, "Change"); SmartColumn fullPath = new SmartColumn(this, PCResources.FullPathColumn, 327, "FullPath"); SmartColumn changeList = new SmartColumn(this, PCResources.ChangeListColumn, 76, "ChangeList"); SmartColumn folder = new SmartColumn(this, PCResources.FolderColumn, 196, "Folder"); SmartColumn locked = new SmartColumn(this, PCResources.LockedColumn, 38, "Locked"); SmartColumn modified = new SmartColumn(this, PCResources.ModifiedColumn, 76, "Modified"); SmartColumn name = new SmartColumn(this, PCResources.NameColumn, 76, "Name"); SmartColumn revision = new SmartColumn(this, PCResources.RevisionColumn, 38, "Revision"); SmartColumn type = new SmartColumn(this, PCResources.TypeColumn, 76, "Type"); SmartColumn workingCopy = new SmartColumn(this, PCResources.WorkingCopyColumn, 76, "WorkingCopy"); Columns.AddRange(new ColumnHeader[] { path, project, change, fullPath }); modified.Sorter = new SortWrapper( delegate(PendingCommitItem x, PendingCommitItem y) { return(x.PendingChange.SvnItem.Modified.CompareTo(y.PendingChange.SvnItem.Modified)); }); revision.Sorter = new SortWrapper( delegate(PendingCommitItem x, PendingCommitItem y) { long?xRev, yRev; xRev = x.PendingChange.Revision; yRev = y.PendingChange.Revision; if (xRev.HasValue && yRev.HasValue) { return(xRev.Value.CompareTo(yRev.Value)); } else if (!xRev.HasValue) { return(yRev.HasValue ? 1 : 0); } else { return(-1); } }); change.Groupable = true; changeList.Groupable = true; folder.Groupable = true; locked.Groupable = true; project.Groupable = true; type.Groupable = true; workingCopy.Groupable = true; path.Hideable = false; AllColumns.Add(change); AllColumns.Add(changeList); AllColumns.Add(folder); AllColumns.Add(fullPath); AllColumns.Add(locked); AllColumns.Add(modified); AllColumns.Add(name); AllColumns.Add(path); AllColumns.Add(project); AllColumns.Add(revision); AllColumns.Add(type); AllColumns.Add(workingCopy); SortColumns.Add(path); GroupColumns.Add(changeList); FinalSortColumn = path; }
public AllGoalsViewModel(GoalData goalData, ProjectData projectData, TaskData taskData) { if (goalData == null) { throw new ArgumentNullException("goalData"); } if (projectData == null) { throw new ArgumentNullException("projectData"); } if (taskData == null) { throw new ArgumentNullException("taskData"); } base.DisplayName = Properties.Resources.Goals_DisplayName; base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/goal.png"; _goalData = goalData; _projectData = projectData; _taskData = taskData; // Subscribe for notifications of when a new goal is saved. _goalData.GoalAdded += this.OnGoalAdded; _goalData.GoalUpdated += this.OnGoalUpdated; _goalData.GoalDeleted += this.OnGoalDeleted; // Populate the AllGoals collection with GoalViewModels. this.AllGoals = new ObservableCollection <GoalViewModel>(); this.AllGoals.CollectionChanged += this.OnCollectionChanged; this.PageFirst(); SortColumns.Add(new SortableProperty() { Description = "Title", Name = "Title" }); SortColumns.Add(new SortableProperty() { Description = "Status", Name = "StatusId" }); SortColumns.Add(new SortableProperty() { Description = "Category", Name = "CategoryId" }); SortColumns.Add(new SortableProperty() { Description = "Date Created", Name = "CreatedDate" }); SortColumns.Add(new SortableProperty() { Description = "Date Completed", Name = "CompletedDate" }); SelectedSortColumn = SortColumns.FirstOrDefault(); // select the first goal GoalViewModel firstGoal = AllGoals.FirstOrDefault(); if (firstGoal != null) { firstGoal.IsSelected = true; } }
private void InitializeColumns() { AllColumns.Clear(); SortColumns.Clear(); Columns.Clear(); _nameColumn = new SmartColumn(this, "&Name", characterWidth * NameColumnNumberOfCharacters, "Name"); SmartColumn modified = new SmartColumn(this, "&Modified", characterWidth * 15, "Modified"); SmartColumn type = new SmartColumn(this, "&Type", characterWidth * 20, "Type"); SmartColumn change = new SmartColumn(this, "&Change", characterWidth * 15, "Change"); SmartColumn locked = new SmartColumn(this, "&Locked", characterWidth * 8, "Locked"); SmartColumn revision = new SmartColumn(this, "&Revision", characterWidth * 8, "Revision"); SmartColumn lastChangeTime = new SmartColumn(this, "Last C&hange", characterWidth * 20, "LastChange"); SmartColumn lastRev = new SmartColumn(this, "Last Re&vision", characterWidth * 8, "LastRevision"); SmartColumn lastAuthor = new SmartColumn(this, "Last &Author", characterWidth * 8, "LastAuthor"); SmartColumn contStatus = new SmartColumn(this, "&Content Status", characterWidth * 15, "ContentStatus"); SmartColumn propStatus = new SmartColumn(this, "&Property Status", characterWidth * 15, "PropertyStatus"); SmartColumn isCopied = new SmartColumn(this, "C&opied", characterWidth * 6, "Copied"); SmartColumn isConficted = new SmartColumn(this, "Co&nflicted", characterWidth * 6, "Conflicted"); SmartColumn fullPath = new SmartColumn(this, "Fu&ll Path", characterWidth * 60, "FullPath"); _nameColumn.Sorter = new SortWrapper( delegate(FileSystemListViewItem x, FileSystemListViewItem y) { if (x.IsDirectory ^ y.IsDirectory) { return(x.IsDirectory ? -1 : 1); } return(StringComparer.OrdinalIgnoreCase.Compare(x.Text, y.Text)); }); modified.Sorter = new SortWrapper( delegate(FileSystemListViewItem x, FileSystemListViewItem y) { return(x.Modified.CompareTo(y.Modified)); }); lastChangeTime.Sorter = new SortWrapper( delegate(FileSystemListViewItem x, FileSystemListViewItem y) { return(x.SvnItem.Status.LastChangeTime.CompareTo(y.SvnItem.Status.LastChangeTime)); }); AllColumns.Add(_nameColumn); AllColumns.Add(modified); AllColumns.Add(type); AllColumns.Add(change); AllColumns.Add(locked); AllColumns.Add(revision); AllColumns.Add(lastChangeTime); AllColumns.Add(lastRev); AllColumns.Add(lastAuthor); AllColumns.Add(contStatus); AllColumns.Add(propStatus); AllColumns.Add(isCopied); AllColumns.Add(isConficted); AllColumns.Add(fullPath); Columns.AddRange( new ColumnHeader[] { _nameColumn, modified, type, change, locked, revision }); SortColumns.Add(_nameColumn); FinalSortColumn = _nameColumn; UpdateSortGlyphs(); }
public void AddSortColumn(string columnName, bool isDescending) { SortColumns.Add(new SearchSortColumn { Name = columnName, IsDescending = isDescending }); }
void Initialize() { SmartColumn path = new SmartColumn(this, PCResources.PathColumn, 288, "Path"); SmartColumn project = new SmartColumn(this, PCResources.ProjectColumn, 76, "Project"); SmartColumn localChange = new SmartColumn(this, PCResources.LocalChangeColumn, 102, "LocalChange"); SmartColumn remoteChange = new SmartColumn(this, PCResources.RemoteChangeColumn, 102, "RemoteChange"); SmartColumn fullPath = new SmartColumn(this, PCResources.FullPathColumn, 327, "FullPath"); SmartColumn changeList = new SmartColumn(this, PCResources.ChangeListColumn, 76, "ChangeList"); SmartColumn folder = new SmartColumn(this, PCResources.FolderColumn, 196, "Folder"); SmartColumn locked = new SmartColumn(this, PCResources.LockedColumn, 38, "Locked"); SmartColumn modified = new SmartColumn(this, PCResources.ModifiedColumn, 76, "Modified"); SmartColumn name = new SmartColumn(this, PCResources.NameColumn, 76, "Name"); SmartColumn type = new SmartColumn(this, PCResources.TypeColumn, 76, "Type"); SmartColumn workingCopy = new SmartColumn(this, PCResources.WorkingCopyColumn, 76, "WorkingCopy"); Columns.AddRange(new ColumnHeader[] { path, project, localChange, remoteChange, fullPath }); localChange.Groupable = true; remoteChange.Groupable = true; changeList.Groupable = true; folder.Groupable = true; locked.Groupable = true; project.Groupable = true; type.Groupable = true; workingCopy.Groupable = true; path.Hideable = false; modified.Sorter = new SortWrapper( delegate(SynchronizeListItem x, SynchronizeListItem y) { return(x.SvnItem.Modified.CompareTo(y.SvnItem.Modified)); }); AllColumns.Add(changeList); AllColumns.Add(folder); AllColumns.Add(fullPath); AllColumns.Add(localChange); AllColumns.Add(locked); AllColumns.Add(modified); AllColumns.Add(name); AllColumns.Add(path); AllColumns.Add(project); AllColumns.Add(remoteChange); AllColumns.Add(type); AllColumns.Add(workingCopy); SortColumns.Add(path); GroupColumns.Add(changeList); FinalSortColumn = path; }
private void InitializeColumns() { SmartColumn name = new SmartColumn(this, RepositoryStrings.NameColumn, 120, "Name"); SmartColumn type = new SmartColumn(this, RepositoryStrings.TypeColumn, 100, "Type"); SmartColumn revision = new SmartColumn(this, RepositoryStrings.RevisionColumn, 60, "Revision"); SmartColumn author = new SmartColumn(this, RepositoryStrings.AuthorColumn, 60, "Author"); SmartColumn size = new SmartColumn(this, RepositoryStrings.SizeColumn, 60, "Size"); SmartColumn date = new SmartColumn(this, RepositoryStrings.DateColumn, 100, "Date"); SmartColumn lockOwner = new SmartColumn(this, RepositoryStrings.LockOwnerColumn, 100, "LockOwner"); name.Sorter = new SortWrapper( delegate(RepositoryListItem x, RepositoryListItem y) { if (x.IsFolder ^ y.IsFolder) { return(x.IsFolder ? -1 : 1); } return(StringComparer.OrdinalIgnoreCase.Compare(x.Text, y.Text)); }); size.Sorter = new SortWrapper( delegate(RepositoryListItem x, RepositoryListItem y) { if (x.IsFolder ^ y.IsFolder) { return(x.IsFolder ? -1 : 1); } long lx = x.Entry.FileSize; long ly = y.Entry.FileSize; if (lx < ly) { return(-1); } else if (lx > ly) { return(1); } else { return(0); } }); date.Sorter = new SortWrapper( delegate(RepositoryListItem x, RepositoryListItem y) { return(x.Entry.Time.CompareTo(y.Entry.Time)); }); AllColumns.Add(name); AllColumns.Add(type); AllColumns.Add(revision); AllColumns.Add(author); AllColumns.Add(size); AllColumns.Add(date); AllColumns.Add(lockOwner); Columns.AddRange(new ColumnHeader[] { name, date, type, revision, author, size, lockOwner }); SortColumns.Add(name); FinalSortColumn = name; UpdateSortGlyphs(); FinalSortColumn = name; AllowColumnReorder = true; }