public GridTableStylesCollectionTests()
        {
            DataGrid grid = new DataGrid();
            GridTableStylesCollection sc = grid.TableStyles;

            sc.CollectionChanged += new CollectionChangeEventHandler(OnCollectionChanged);

            Console.WriteLine("GridColumnStylesCollection default --- ");
            DumpGridTableStylesCollection(sc);

            Console.WriteLine("Add single item");
            DataGridTableStyle ts = new DataGridTableStyle();

            ts.MappingName = "Table1";
            sc.Add(ts);

            Console.WriteLine("Add multipleitems");
            sc.AddRange(new DataGridTableStyle [] { new DataGridTableStyle(), new DataGridTableStyle() });
            Console.WriteLine("Remove At");
            sc.RemoveAt(2);

            Console.WriteLine("Add single item");
            ts             = new DataGridTableStyle();
            ts.MappingName = "Table2";
            sc.Add(ts);

            for (int i = 0; i < sc.Count; i++)
            {
                Console.WriteLine("Element {0}:{1}", i, sc[i].MappingName);
            }

            sc.Remove(ts);
            Console.WriteLine("Contains Table1 {0}", sc.Contains("Table1"));
            Console.WriteLine("Contains Table4 {0}", sc.Contains("Table4"));
        }
        public void TestAddRange()
        {
            DataGrid grid = new DataGrid();
            GridTableStylesCollection sc = grid.TableStyles;

            sc.CollectionChanged += new CollectionChangeEventHandler(OnCollectionEventHandler);

            ResetEventData();
            DataGridTableStyle ts1 = new DataGridTableStyle();

            ts1.MappingName = "Table1";

            DataGridTableStyle ts2 = new DataGridTableStyle();

            ts2.MappingName = "Table2";
            sc.AddRange(new DataGridTableStyle[] { ts1, ts2 });

            Assert.AreEqual(true, eventhandled, "A1");
            Assert.AreEqual(null, Element, "A2");
            Assert.AreEqual(CollectionChangeAction.Refresh, Action, "A3");
            Assert.AreEqual(1, times, "A4");
        }
        public void TestAdd()
        {
            DataGrid grid = new DataGrid();
            GridTableStylesCollection sc = grid.TableStyles;

            sc.CollectionChanged += new CollectionChangeEventHandler(OnCollectionEventHandler);

            // Add single
            ResetEventData();
            DataGridTableStyle ts = new DataGridTableStyle();

            ts.MappingName = "Table1";
            sc.Add(ts);
            Assert.AreEqual(true, eventhandled, "A1");
            Assert.AreEqual(ts, Element, "A2");
            Assert.AreEqual(CollectionChangeAction.Add, Action, "A3");

            // Add multiple
            ResetEventData();
            sc.AddRange(new DataGridTableStyle [] { new DataGridTableStyle(), new DataGridTableStyle() });
            Assert.AreEqual(true, eventhandled, "A4");
            Assert.AreEqual(null, Element, "A5");
            Assert.AreEqual(CollectionChangeAction.Refresh, Action, "A6");
        }