Beispiel #1
0
        public BindingConfiguration CreatBindingConfiguration(IControlConfiguration dependency)
        {
            if (dependency == null)
            {
                throw new NullReferenceException("ControlConfiguraiton is null.");
            }

            BindingConfiguration configuration;

            switch (dependency.Mode)
            {
            case ControlMode.Standard:
                configuration = new BindingConfiguration();
                break;

            case ControlMode.Paging:
                configuration = new BindingConfiguration(((PagingConfiguration)dependency).Max);
                break;

            default:
                throw new NotSupportedException(dependency.Mode.ToString() + " is not supported yet.");
            }

            configuration.PropertyChanged += this.BindingConfigurationPropertyChangedHandler;

            return(configuration);
        }
        private static void OnControlTemplateChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            TiramisuDataGrid me = sender as TiramisuDataGrid;

            if (me == null)
            {
                return;
            }

            IControlConfiguration newValue = e.NewValue as IControlConfiguration;
            IControlConfiguration oldValue = e.OldValue as IControlConfiguration;

            if (oldValue != null)
            {
                me.proxy.Detach(oldValue);
            }

            if (newValue != null)
            {
                me.proxy.Attach(newValue);
            }

            me.ControlTemplate = newValue;
        }