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); }
public void AdjustBinding(ItemsControl itemsControl, BindingConfiguration configuration, string changedProperty) { if (changedProperty == "Skip") { itemsControl.ItemsSource = this.LoadFromOriginalSource(configuration).Skip(configuration.Skip).Take(configuration.Limit); } }
public void ResolveDependency(object dependency) { if (this.bindingConfiguration != null) { this.bindingConfiguration.PropertyChanged -= this.BindingConfigurationPropertyChangedHandler; } this.bindingConfiguration = this.CreatBindingConfiguration(dependency as IControlConfiguration); }
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); } }
public override IEnumerable <T> LoadFromFile(string path, BindingConfiguration configuration) { throw new NotImplementedException(); }
public override IEnumerable <T> LoadFromOriginalSource(BindingConfiguration configuration) { return(this.collection); }
public abstract IEnumerable <T> LoadFromOriginalSource(BindingConfiguration configuration);
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);