Two-level grouped data displayed in WPF (CSWPFTwoLevelGrouping)

The sample demonstrates how to display two-level grouped data in WPF.

C# (51.2 KB)
 
 
 
 
 
4.4 Star
(5)
19,548 times
Add to favorites
5/5/2011
E-mail Twitter del.icio.us Digg Facebook
WPF
Sign in to ask a question


  • How to access resources in UserControl
    2 Posts | Last post December 31, 2014
    • My XAML file root element is <UserControl> instead of <Window>
      How can I modify the code of the following to allow me access my "FirstLevel" and "SecondLevel" style in container of <UserControl.Resources>?
      Because the "Application.Current.MainWindow" returns null.
      
      Window window = Application.Current.MainWindow;
                  
      if (!group.IsBottomLevel)
      {
          s = window.FindResource("FirstLevel") as Style;
      }
      else
      {
          s = window.FindResource("SecondLevel") as Style;
      }
    • On Your UserControl you can have these:
      xmlns:local="clr-namespace:'Your MainWindow'"
      
      <Window.Resources>
      <local:GroupItemStyleSelector x:Key="groupItemStyleSelector"/>
      </Window.Resources>
      
      And the Style have to be on your MainWindow and the: 
      Window window = Application.Current.MainWindow;
      
                  
      
      if (!group.IsBottomLevel)
      
      {
      
          s = window.FindResource("FirstLevel") as Style;
      
      }
      
      else
      
      {
      
          s = window.FindResource("SecondLevel") as Style;
      
      }
      
      have to be on your mainwindow, you just have to tell in the mainwindow, how you want your Usercontrol to act..
      
      Any problems just say so and I'll try to help more..