Example #1
0
        private bool IsNotExistsConn(AppDbSettings val)
        {
            if (val.ConnGuid.Length == 0)
            {
                return(true);
            }

            IParent p = (IParent)val;

            while (p.Parent != null)
            {
                p = p.Parent;
            }

            Config cfg = (Config)p;

            foreach (var t in cfg.GroupPlugins.ListPlugins)
            {
                foreach (var tt in t.ListGenerators)
                {
                    foreach (var ttt in tt.ListSettings)
                    {
                        if (ttt.Guid == val.ConnGuid)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
        public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem)
        {
            Contract.Requires(propertyItem != null);
            AppDbSettings dt  = (AppDbSettings)propertyItem.Instance;
            ComboBox      cbx = new ComboBox();

            cbx.DisplayMemberPath = "Name";
            cbx.SelectedValuePath = "Guid";
            var _binding_lst = new Binding("ListPluginGens"); // bind to the Value property of the PropertyItem

            _binding_lst.Source = dt;
            _binding_lst.ValidatesOnExceptions = false;
            _binding_lst.ValidatesOnDataErrors = false;
            _binding_lst.Mode = BindingMode.OneWay;
            BindingOperations.SetBinding(cbx, ComboBox.ItemsSourceProperty, _binding_lst);
            var _binding = new Binding("Value"); // bind to the Value property of the PropertyItem

            _binding.Source = propertyItem;
            _binding.ValidatesOnExceptions = true;
            _binding.ValidatesOnDataErrors = true;
            _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
            BindingOperations.SetBinding(cbx, ComboBox.SelectedValueProperty, _binding);
            return(cbx);
        }