// Token: 0x060057FE RID: 22526 RVA: 0x00186080 File Offset: 0x00184280
        private static BindingExpression CreateBindingExpression(ItemsControl itemsControl, object item, string primaryTextPath)
        {
            Binding binding = new Binding();

            if (SystemXmlHelper.IsXmlNode(item))
            {
                binding.XPath = primaryTextPath;
                binding.Path  = new PropertyPath("/InnerText", new object[0]);
            }
            else
            {
                binding.Path = new PropertyPath(primaryTextPath, new object[0]);
            }
            binding.Mode   = BindingMode.OneWay;
            binding.Source = null;
            return((BindingExpression)BindingExpressionBase.CreateUntargetedBindingExpression(itemsControl, binding));
        }
Beispiel #2
0
        // Token: 0x060058D9 RID: 22745 RVA: 0x0018931C File Offset: 0x0018751C
        private BindingExpression PrepareSelectedValuePathBindingExpression(object item)
        {
            if (item == null)
            {
                return(null);
            }
            bool flag = SystemXmlHelper.IsXmlNode(item);
            BindingExpression bindingExpression = TreeView.SelectedValuePathBindingExpression.GetValue(this);

            if (bindingExpression != null)
            {
                Binding binding = bindingExpression.ParentBinding;
                bool    flag2   = binding.XPath != null;
                if (flag2 != flag)
                {
                    bindingExpression = null;
                }
            }
            if (bindingExpression == null)
            {
                Binding binding = new Binding();
                binding.Source = null;
                if (flag)
                {
                    binding.XPath = this.SelectedValuePath;
                    binding.Path  = new PropertyPath("/InnerText", new object[0]);
                }
                else
                {
                    binding.Path = new PropertyPath(this.SelectedValuePath, new object[0]);
                }
                bindingExpression = (BindingExpression)BindingExpressionBase.CreateUntargetedBindingExpression(this, binding);
                TreeView.SelectedValuePathBindingExpression.SetValue(this, bindingExpression);
            }
            return(bindingExpression);
        }