Exemple #1
0
        private static void OnIconWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            EnumControl ec = d as EnumControl;

            if (ec != null)
            {
                var column1 = ec.LayoutRoot.ColumnDefinitions[0];
                try
                {
                    double colwidth = (double)e.NewValue;
                    column1.Width = new GridLength(colwidth);
                }
                catch (System.Exception)
                {
                }
            }
        }
Exemple #2
0
        private static void SetNewBinding(object args, DependencyObject dependencyObject)
        {
            string dp = args as string;

            if (dp != null)
            {
                Binding valBinding = new Binding();
                valBinding.Path = new PropertyPath(dp);
                valBinding.Mode = BindingMode.TwoWay;


                EnumControl ec = dependencyObject as EnumControl;
                if (ec != null)
                {
                    ec.dataPath = dp;
                    ec.EnumCombobox.SetBinding(ComboBox.SelectedValueProperty, valBinding);
                }
            }
        }