diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/DataSource.cs b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/DataSource.cs new file mode 100644 index 0000000..568663e --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/DataSource.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace GroupingTreeView +{ + public class Animal + { + private string name; + + public string Name + { + get { return name; } + set { name = value; } + } + + private Category category; + + public Category Category + { + get { return category; } + set { category = value; } + } + + public Animal(string name, Category category) + { + this.name = name; + this.category = category; + } + } + + public enum Category + { + Amphibians, + Bears, + BigCats, + Canines, + Primates, + Spiders, + } + + public class Animals + { + private List animalList; + + public IEnumerable AnimalList + { + get { return animalList; } + } + + public Animals() + { + animalList = new List(); + animalList.Add(new Animal("California Newt", Category.Amphibians)); + animalList.Add(new Animal("Giant Panda", Category.Bears)); + animalList.Add(new Animal("Coyote", Category.Canines)); + animalList.Add(new Animal("Golden Silk Spider", Category.Spiders)); + animalList.Add(new Animal("Mandrill", Category.Primates)); + animalList.Add(new Animal("Black Bear", Category.Bears)); + animalList.Add(new Animal("Jaguar", Category.BigCats)); + animalList.Add(new Animal("Bornean Gibbon", Category.Primates)); + animalList.Add(new Animal("African Wildcat", Category.BigCats)); + animalList.Add(new Animal("Arctic Fox", Category.Canines)); + animalList.Add(new Animal("Tomato Frog", Category.Amphibians)); + animalList.Add(new Animal("Grizzly Bear", Category.Bears)); + animalList.Add(new Animal("Dingo", Category.Canines)); + animalList.Add(new Animal("Gorilla", Category.Primates)); + animalList.Add(new Animal("Green Tree Frog", Category.Amphibians)); + animalList.Add(new Animal("Bald Uakari", Category.Primates)); + animalList.Add(new Animal("Polar Bear", Category.Bears)); + animalList.Add(new Animal("Black Widow Spider", Category.Spiders)); + animalList.Add(new Animal("Bat-Eared Fox", Category.Canines)); + animalList.Add(new Animal("Cheetah", Category.BigCats)); + } + } +} diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.5.0.resharper.user b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.5.0.resharper.user new file mode 100644 index 0000000..4d7c088 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.5.0.resharper.user @@ -0,0 +1,11 @@ + + + + +TeamCity; + + + + False + + + \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.csproj b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.csproj new file mode 100644 index 0000000..6303243 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.csproj @@ -0,0 +1,92 @@ + + + Debug + AnyCPU + {85B6A0DA-47D9-4347-97C4-89F70D3B2557} + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + GroupingTreeView + GroupingTreeView + 4 + winexe + 1.0.0.* + + false + v3.0 + + + 2.0 + + + + + true + full + false + .\bin\Debug\ + DEBUG;TRACE + + + false + true + .\bin\Release\ + TRACE + + + + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MyApp.xaml + Code + + + Window1.xaml + Code + + + + + + + ResXFileCodeGenerator + Designer + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + True + Resources.resx + + + True + True + Settings.settings + + + + + \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.sln b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.sln new file mode 100644 index 0000000..edc9a2d --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GroupingTreeView", "GroupingTreeView.csproj", "{85B6A0DA-47D9-4347-97C4-89F70D3B2557}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {85B6A0DA-47D9-4347-97C4-89F70D3B2557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85B6A0DA-47D9-4347-97C4-89F70D3B2557}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85B6A0DA-47D9-4347-97C4-89F70D3B2557}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85B6A0DA-47D9-4347-97C4-89F70D3B2557}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.suo b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.suo new file mode 100644 index 0000000..7952f37 Binary files /dev/null and b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/GroupingTreeView.suo differ diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/MyApp.xaml b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/MyApp.xaml new file mode 100644 index 0000000..35566c3 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/MyApp.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/MyApp.xaml.cs b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/MyApp.xaml.cs new file mode 100644 index 0000000..db1f60d --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/MyApp.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Windows; +using System.Data; +using System.Xml; +using System.Configuration; + +namespace GroupingTreeView +{ + /// + /// Interaction logic for MyApp.xaml + /// + + public partial class MyApp : Application + { + + } +} \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/AssemblyInfo.cs b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1e66b97 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/AssemblyInfo.cs @@ -0,0 +1,54 @@ +#region Using directives + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Resources; +using System.Globalization; +using System.Windows; +using System.Runtime.InteropServices; + +#endregion + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("GroupingTreeView")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GroupingTreeView")] +[assembly: AssemblyCopyright("Copyright @ 2006")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Resources.Designer.cs b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Resources.Designer.cs new file mode 100644 index 0000000..0ee2cd4 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1318 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GroupingTreeView.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GroupingTreeView.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Resources.resx b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Resources.resx new file mode 100644 index 0000000..3e18af9 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Settings.Designer.cs b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Settings.Designer.cs new file mode 100644 index 0000000..742c53d --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1318 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GroupingTreeView.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Settings.settings b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Settings.settings new file mode 100644 index 0000000..4024694 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Window1.xaml b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Window1.xaml new file mode 100644 index 0000000..7cb13e4 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Window1.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Window1.xaml.cs b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Window1.xaml.cs new file mode 100644 index 0000000..9036c7d --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView - Orcas Beta 2/Window1.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using System.Collections.Generic; + + +namespace GroupingTreeView +{ + /// + /// Interaction logic for Window1.xaml + /// + + public partial class Window1 : Window + { + public Window1() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView/DataSource.cs b/15-GroupingTreeView/15GroupingTreeView/DataSource.cs new file mode 100644 index 0000000..568663e --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/DataSource.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace GroupingTreeView +{ + public class Animal + { + private string name; + + public string Name + { + get { return name; } + set { name = value; } + } + + private Category category; + + public Category Category + { + get { return category; } + set { category = value; } + } + + public Animal(string name, Category category) + { + this.name = name; + this.category = category; + } + } + + public enum Category + { + Amphibians, + Bears, + BigCats, + Canines, + Primates, + Spiders, + } + + public class Animals + { + private List animalList; + + public IEnumerable AnimalList + { + get { return animalList; } + } + + public Animals() + { + animalList = new List(); + animalList.Add(new Animal("California Newt", Category.Amphibians)); + animalList.Add(new Animal("Giant Panda", Category.Bears)); + animalList.Add(new Animal("Coyote", Category.Canines)); + animalList.Add(new Animal("Golden Silk Spider", Category.Spiders)); + animalList.Add(new Animal("Mandrill", Category.Primates)); + animalList.Add(new Animal("Black Bear", Category.Bears)); + animalList.Add(new Animal("Jaguar", Category.BigCats)); + animalList.Add(new Animal("Bornean Gibbon", Category.Primates)); + animalList.Add(new Animal("African Wildcat", Category.BigCats)); + animalList.Add(new Animal("Arctic Fox", Category.Canines)); + animalList.Add(new Animal("Tomato Frog", Category.Amphibians)); + animalList.Add(new Animal("Grizzly Bear", Category.Bears)); + animalList.Add(new Animal("Dingo", Category.Canines)); + animalList.Add(new Animal("Gorilla", Category.Primates)); + animalList.Add(new Animal("Green Tree Frog", Category.Amphibians)); + animalList.Add(new Animal("Bald Uakari", Category.Primates)); + animalList.Add(new Animal("Polar Bear", Category.Bears)); + animalList.Add(new Animal("Black Widow Spider", Category.Spiders)); + animalList.Add(new Animal("Bat-Eared Fox", Category.Canines)); + animalList.Add(new Animal("Cheetah", Category.BigCats)); + } + } +} diff --git a/15-GroupingTreeView/15GroupingTreeView/GroupingTreeView.csproj b/15-GroupingTreeView/15GroupingTreeView/GroupingTreeView.csproj new file mode 100644 index 0000000..0266477 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/GroupingTreeView.csproj @@ -0,0 +1,79 @@ + + + Debug + AnyCPU + {85B6A0DA-47D9-4347-97C4-89F70D3B2557} + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + GroupingTreeView + GroupingTreeView + 4 + winexe + 1.0.0.* + + false + + + true + full + false + .\bin\Debug\ + DEBUG;TRACE + + + false + true + .\bin\Release\ + TRACE + + + + + + + + + + + + + + + + + + + + + MyApp.xaml + Code + + + Window1.xaml + Code + + + + + + + ResXFileCodeGenerator + Resources.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.cs + + + True + Settings.settings + + + + + + \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView/GroupingTreeView.sln b/15-GroupingTreeView/15GroupingTreeView/GroupingTreeView.sln new file mode 100644 index 0000000..1fc06d4 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/GroupingTreeView.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GroupingTreeView", "GroupingTreeView.csproj", "{85B6A0DA-47D9-4347-97C4-89F70D3B2557}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {85B6A0DA-47D9-4347-97C4-89F70D3B2557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85B6A0DA-47D9-4347-97C4-89F70D3B2557}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85B6A0DA-47D9-4347-97C4-89F70D3B2557}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85B6A0DA-47D9-4347-97C4-89F70D3B2557}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/15-GroupingTreeView/15GroupingTreeView/GroupingTreeView.suo b/15-GroupingTreeView/15GroupingTreeView/GroupingTreeView.suo new file mode 100644 index 0000000..f3c912e Binary files /dev/null and b/15-GroupingTreeView/15GroupingTreeView/GroupingTreeView.suo differ diff --git a/15-GroupingTreeView/15GroupingTreeView/MyApp.xaml b/15-GroupingTreeView/15GroupingTreeView/MyApp.xaml new file mode 100644 index 0000000..4eee779 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/MyApp.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/15-GroupingTreeView/15GroupingTreeView/MyApp.xaml.cs b/15-GroupingTreeView/15GroupingTreeView/MyApp.xaml.cs new file mode 100644 index 0000000..db1f60d --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/MyApp.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Windows; +using System.Data; +using System.Xml; +using System.Configuration; + +namespace GroupingTreeView +{ + /// + /// Interaction logic for MyApp.xaml + /// + + public partial class MyApp : Application + { + + } +} \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView/Properties/AssemblyInfo.cs b/15-GroupingTreeView/15GroupingTreeView/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1e66b97 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/Properties/AssemblyInfo.cs @@ -0,0 +1,54 @@ +#region Using directives + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Resources; +using System.Globalization; +using System.Windows; +using System.Runtime.InteropServices; + +#endregion + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("GroupingTreeView")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GroupingTreeView")] +[assembly: AssemblyCopyright("Copyright @ 2006")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/15-GroupingTreeView/15GroupingTreeView/Properties/Resources.cs b/15-GroupingTreeView/15GroupingTreeView/Properties/Resources.cs new file mode 100644 index 0000000..a39541f --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/Properties/Resources.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GroupingTreeView.Properties +{ + using System; + using System.IO; + using System.Resources; + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the Strongly Typed Resource Builder + // class via a tool like ResGen or Visual Studio.NET. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + class Resources + { + + private static System.Resources.ResourceManager _resMgr; + + private static System.Globalization.CultureInfo _resCulture; + + /*FamANDAssem*/ + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Resources.ResourceManager ResourceManager + { + get + { + if ((_resMgr == null)) + { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Resources", typeof(Resources).Assembly); + _resMgr = temp; + } + return _resMgr; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Globalization.CultureInfo Culture + { + get + { + return _resCulture; + } + set + { + _resCulture = value; + } + } + } +} diff --git a/15-GroupingTreeView/15GroupingTreeView/Properties/Resources.resx b/15-GroupingTreeView/15GroupingTreeView/Properties/Resources.resx new file mode 100644 index 0000000..3e18af9 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView/Properties/Settings.cs b/15-GroupingTreeView/15GroupingTreeView/Properties/Settings.cs new file mode 100644 index 0000000..5a5e7cd --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/Properties/Settings.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GroupingTreeView.Properties +{ + public partial class Settings : System.Configuration.ApplicationSettingsBase + { + private static Settings m_Value; + + private static object m_SyncObject = new object(); + + public static Settings Value + { + get + { + if ((Settings.m_Value == null)) + { + System.Threading.Monitor.Enter(Settings.m_SyncObject); + if ((Settings.m_Value == null)) + { + try + { + Settings.m_Value = new Settings(); + } + finally + { + System.Threading.Monitor.Exit(Settings.m_SyncObject); + } + } + } + return Settings.m_Value; + } + } + } +} diff --git a/15-GroupingTreeView/15GroupingTreeView/Properties/Settings.settings b/15-GroupingTreeView/15GroupingTreeView/Properties/Settings.settings new file mode 100644 index 0000000..4024694 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/15-GroupingTreeView/15GroupingTreeView/Window1.xaml b/15-GroupingTreeView/15GroupingTreeView/Window1.xaml new file mode 100644 index 0000000..1b6ad69 --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/Window1.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/15-GroupingTreeView/15GroupingTreeView/Window1.xaml.cs b/15-GroupingTreeView/15GroupingTreeView/Window1.xaml.cs new file mode 100644 index 0000000..9036c7d --- /dev/null +++ b/15-GroupingTreeView/15GroupingTreeView/Window1.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using System.Collections.Generic; + + +namespace GroupingTreeView +{ + /// + /// Interaction logic for Window1.xaml + /// + + public partial class Window1 : Window + { + public Window1() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/15-GroupingTreeView/Images/15GroupingTreeView.png b/15-GroupingTreeView/Images/15GroupingTreeView.png new file mode 100644 index 0000000..3e6ff47 Binary files /dev/null and b/15-GroupingTreeView/Images/15GroupingTreeView.png differ diff --git a/15-GroupingTreeView/README.md b/15-GroupingTreeView/README.md new file mode 100644 index 0000000..b017a61 --- /dev/null +++ b/15-GroupingTreeView/README.md @@ -0,0 +1,36 @@ +# How to display grouped data in a TreeView + +The TreeView control is great at displaying structured data using the HierarchicalDataTemplate (see Karsten's blog post on this topic). But what do you do if the data you're given is not structured hierarchically? In this post, I will show you how to create that hierarchy from a flat list of data items, using the grouping feature of data binding. + +I am using the same Animal data source I used in my last post. Grouping the Animals by Category is done the same way as in my last sample: + + + + + + + + + +We now have the data in a hierarchical form. In this particular case it has only one level of groups, and another level with the animals. You can easily imagine that by adding more GroupDescriptions you would end up with a deeper hierarchy. + +When binding to a CollectionViewSource, the Binding object knows to grab the CollectionViewSource's View property. This property returns the custom view (of type ICollectionView) that CollectionViewSource creates on top of the data collection (where the grouping is applied). In our scenario, we want to bind to the hierarchy we created with grouping, or in other words, we want to bind to the groups. We can get to this data by binding to the Groups property in ICollectionView: + + + + +When using data binding's grouping feature, each group of items is wrapped in a CollectionViewGroup object. We can access the name of the group (the property we're grouping by) by using CollectionViewGroup's Name property, and we can get to the items that belong to the group through the Items property. This is all the information we need in order to make a HierarchicalDataTemplate that will display the Category of each animal and specify the animals that belong to it: + + + + + +Finally we need a DataTemplate for the leaf nodes, which specifies how we want the Animal data to be displayed. In this case, we are interested in displaying the Name property of each Animal. Notice that the HierarchicalDataTemplate's ItemTemplate property points to this template. + + + + + +Here is the result of the completed sample: + +![](Images/15GroupingTreeView.png)