Click here to Skip to main content
15,887,027 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: How to get event of button inside stackpanel?very urgent.... Pin
Mark Salsbery14-May-09 7:07
Mark Salsbery14-May-09 7:07 
GeneralRe: How to get event of button inside stackpanel?very urgent.... Pin
salon17-May-09 20:09
salon17-May-09 20:09 
GeneralRe: How to get event of button inside stackpanel?very urgent.... Pin
VbGuru61326-Aug-10 7:58
VbGuru61326-Aug-10 7:58 
QuestionSorting ObservableCollection Pin
Kunal Chowdhury «IN»14-May-09 0:21
professionalKunal Chowdhury «IN»14-May-09 0:21 
AnswerRe: Sorting ObservableCollection Pin
Pete O'Hanlon14-May-09 1:39
mvePete O'Hanlon14-May-09 1:39 
AnswerRe: Sorting ObservableCollection Pin
Kunal Chowdhury «IN»14-May-09 2:21
professionalKunal Chowdhury «IN»14-May-09 2:21 
GeneralRe: Sorting ObservableCollection Pin
BlitzPackage14-May-09 9:41
BlitzPackage14-May-09 9:41 
GeneralRe: Sorting ObservableCollection Pin
Pete O'Hanlon14-May-09 10:25
mvePete O'Hanlon14-May-09 10:25 
Then I would recommend writing a specialist observable collection. Here's a variant of one I use:
public class SortObservableCollection<T> : ObservableCollection<T>
{
  public void Sort<TResult>(Func<T, TResult> expression, ListSortDirection sortDirection)
  {
    switch (sortDirection)
    {
      case ListSortDirection.Ascending:
        Sort(Items.OrderBy(expression));
        break;
      case ListSortDirection.Descending:
        Sort(Items.OrderByDescending(expression));
        break;
    }
  }

  private void Sort(IEnumerable<T> items)
  {
    var sort = items.ToList();
    foreach (var item in sort)
    {
      Move(IndexOf(item), sort.IndexOf(item));
    }
  }
}


"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



GeneralRe: Sorting ObservableCollection Pin
Kunal Chowdhury «IN»14-May-09 20:54
professionalKunal Chowdhury «IN»14-May-09 20:54 
GeneralRe: Sorting ObservableCollection Pin
Pete O'Hanlon14-May-09 22:29
mvePete O'Hanlon14-May-09 22:29 
GeneralRe: Sorting ObservableCollection Pin
Kunal Chowdhury «IN»14-May-09 23:15
professionalKunal Chowdhury «IN»14-May-09 23:15 
GeneralRe: Sorting ObservableCollection Pin
Pete O'Hanlon15-May-09 0:40
mvePete O'Hanlon15-May-09 0:40 
AnswerRe: Sorting ObservableCollection Pin
Michael Sync14-May-09 15:58
Michael Sync14-May-09 15:58 
GeneralRe: Sorting ObservableCollection Pin
BlitzPackage15-May-09 15:32
BlitzPackage15-May-09 15:32 
GeneralRe: Sorting ObservableCollection Pin
Michael Sync15-May-09 22:19
Michael Sync15-May-09 22:19 
GeneralRe: Sorting ObservableCollection Pin
Kevin McFarlane16-May-09 6:37
Kevin McFarlane16-May-09 6:37 
AnswerRe: Sorting ObservableCollection Pin
Sebastian Solnica22-Nov-09 22:43
Sebastian Solnica22-Nov-09 22:43 
QuestionHelp: Binding huge data making application slower with 95% CPU usage Pin
Kunal Chowdhury «IN»13-May-09 19:37
professionalKunal Chowdhury «IN»13-May-09 19:37 
QuestionRe: Help: Binding huge data making application slower with 95% CPU usage Pin
Mark Salsbery14-May-09 7:18
Mark Salsbery14-May-09 7:18 
AnswerRe: Help: Binding huge data making application slower with 95% CPU usage [modified] Pin
Kunal Chowdhury «IN»14-May-09 18:38
professionalKunal Chowdhury «IN»14-May-09 18:38 
QuestionGot some problem with wpf multibinding Pin
Eric Vonjacson13-May-09 1:56
Eric Vonjacson13-May-09 1:56 
AnswerRe: Got some problem with wpf multibinding Pin
Mark Salsbery13-May-09 6:25
Mark Salsbery13-May-09 6:25 
AnswerRe: Got some problem with wpf multibinding Pin
Ian Shlasko13-May-09 8:18
Ian Shlasko13-May-09 8:18 
NewsGet started with Silverlight at XAMLFest Online in June Pin
brucedkyle12-May-09 9:49
brucedkyle12-May-09 9:49 
NewsGet started with WPF with XAMLFest Online in June Pin
brucedkyle12-May-09 9:48
brucedkyle12-May-09 9:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.