예제 #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);
        }
예제 #2
0
 public void AdjustBinding(ItemsControl itemsControl, BindingConfiguration configuration, string changedProperty)
 {
     if (changedProperty == "Skip")
     {
         itemsControl.ItemsSource = this.LoadFromOriginalSource(configuration).Skip(configuration.Skip).Take(configuration.Limit);
     }
 }
예제 #3
0
        public void ResolveDependency(object dependency)
        {
            if (this.bindingConfiguration != null)
            {
                this.bindingConfiguration.PropertyChanged -= this.BindingConfigurationPropertyChangedHandler;
            }

            this.bindingConfiguration = this.CreatBindingConfiguration(dependency as IControlConfiguration);
        }
예제 #4
0
 public void Bind(ItemsControl itemsControl, BindingConfiguration configuration)
 {
     if (configuration.Limit == int.MaxValue)
     {
         itemsControl.ItemsSource = this.LoadFromOriginalSource(configuration);
     }
     else
     {
         itemsControl.ItemsSource = this.LoadFromOriginalSource(configuration).Take(configuration.Limit);
     }
 }
예제 #5
0
 public override IEnumerable <T> LoadFromFile(string path, BindingConfiguration configuration)
 {
     throw new NotImplementedException();
 }
 public override IEnumerable <T> LoadFromOriginalSource(BindingConfiguration configuration)
 {
     return(this.collection);
 }
예제 #7
0
 public abstract IEnumerable <T> LoadFromOriginalSource(BindingConfiguration configuration);
예제 #8
0
 private void BindingConfigurationPropertyChangedHandler(object sender, PropertyChangedEventArgs e)
 {
     this.bindingConfiguration = sender as BindingConfiguration;
     this.AdjustBinding(this.GetItemsControl(), this.bindingConfiguration, e.PropertyName);
 }
 public override IEnumerable <T> LoadFromOriginalSource(BindingConfiguration configuration)
 {
     return(this.LoadFromFile(this.path, configuration));
 }
 public abstract IEnumerable <T> LoadFromFile(string path, BindingConfiguration configuration);