public void PersistentProperties_shall_requery_its_value_if_bound_id_is_changed()
        {
            PersistentPropertyControlTree ControlTree = new PersistentPropertyControlTree();
            TestValueStore TestValueStore             = (TestValueStore)ControlTree.FindResource("PersistentProperties");

            TestValueStore["One.Bound.Three.Text"]               = "Hello, binding!";
            TestValueStore["One.Changed.Three.Text"]             = "Hello, another binding!";
            TestValueStore["One.Bound.ThreeTemplated.Opacity"]   = .1;
            TestValueStore["One.Changed.ThreeTemplated.Opacity"] = .9;

            Values  Values  = new Values("Bound");
            Binding Binding = new Binding("Value");

            Binding.Mode   = BindingMode.OneWay;
            Binding.Source = Values;
            ControlTree.Two.SetBinding(PersistentProperty.IdProperty, Binding);

            Assert.AreEqual("Hello, binding!", ControlTree.Three.Text);
            Assert.AreEqual(.1, ControlTree.DataTemplate.Opacity);

            Values.Value = "Changed";

            Assert.AreEqual("Hello, another binding!", ControlTree.Three.Text);
            Assert.AreEqual(.9, ControlTree.DataTemplate.Opacity);
        }
        public void PersistentProperties_shall_be_stored_when_changed_in_UI()
        {
            PersistentPropertyControlTree ControlTree = new PersistentPropertyControlTree();
            TestValueStore TestValueStore             = (TestValueStore)ControlTree.FindResource("PersistentProperties");

            ControlTree.Three.Text           = "Hello, world!";
            ControlTree.DataTemplate.Opacity = 1;

            Assert.AreEqual("Hello, world!", ControlTree.Three.Text);
            Assert.AreEqual("Hello, world!", TestValueStore["One.Two.Three.Text"]);

            Assert.AreEqual(1, ControlTree.DataTemplate.Opacity);
            Assert.AreEqual(1d, TestValueStore["One.Two.ThreeTemplated.Opacity"]);
        }
        public void PersistentProperties_shall_work_also_with_bound_context_ids()
        {
            PersistentPropertyControlTree ControlTree = new PersistentPropertyControlTree();
            TestValueStore TestValueStore             = (TestValueStore)ControlTree.FindResource("PersistentProperties");

            TestValueStore["One.Bound.Three.Text"]             = "Hello, binding!";
            TestValueStore["One.Bound.ThreeTemplated.Opacity"] = 1;

            Binding Binding = new Binding("Value");

            Binding.Mode   = BindingMode.OneWay;
            Binding.Source = new Values("Bound");
            ControlTree.Two.SetBinding(PersistentProperty.IdProperty, Binding);

            Assert.AreEqual("Hello, binding!", ControlTree.Three.Text);
            Assert.AreEqual(1, ControlTree.DataTemplate.Opacity);
        }