Exemplo n.º 1
0
        private static NestedBindingsTree GetNestedBindingsTree(NestedBinding nestedBinding, MultiBinding multiBinding)
        {
            var tree = new NestedBindingsTree
            {
                Converter          = nestedBinding.Converter,
                ConverterParameter = nestedBinding.ConverterParameter,
                ConverterCulture   = nestedBinding.ConverterCulture
            };

            foreach (var bindingBase in nestedBinding.Bindings)
            {
                var binding            = bindingBase as Binding;
                var childNestedBinding = binding?.Source as NestedBinding;
                if (childNestedBinding != null && binding.Converter == null)
                {
                    tree.Nodes.Add(GetNestedBindingsTree(childNestedBinding, multiBinding));
                    continue;
                }

                tree.Nodes.Add(new NestedBindingNode(multiBinding.Bindings.Count));
                multiBinding.Bindings.Add(bindingBase);
            }

            return(tree);
        }
Exemplo n.º 2
0
        private static NestedBindingsTree GetNestedBindingsTree(NestedBinding nestedBinding, MultiBinding multiBinding)
        {
            var tree = new NestedBindingsTree
            {
                Converter = nestedBinding.Converter,
                ConverterParameter = nestedBinding.ConverterParameter,
                ConverterCulture = nestedBinding.ConverterCulture
            };
            foreach (var bindingBase in nestedBinding.Bindings)
            {
                var binding = bindingBase as Binding;
                var childNestedBinding = binding?.Source as NestedBinding;
                if (childNestedBinding != null && binding.Converter == null)
                {
                    tree.Nodes.Add(GetNestedBindingsTree(childNestedBinding, multiBinding));
                    continue;
                }

                tree.Nodes.Add(new NestedBindingNode(multiBinding.Bindings.Count));
                multiBinding.Bindings.Add(bindingBase);
            }

            return tree;
        }