• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# BindingSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BindingSource的典型用法代码示例。如果您正苦于以下问题:C# BindingSource类的具体用法?C# BindingSource怎么用?C# BindingSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BindingSource类属于命名空间,在下文中一共展示了BindingSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetEnumerableValueProvider

 protected override IEnumerableValueProvider GetEnumerableValueProvider(
     BindingSource bindingSource,
     Dictionary<string, StringValues> values,
     CultureInfo culture)
 {
     return new JQueryFormValueProvider(bindingSource, values, culture);
 }
开发者ID:phinq19,项目名称:git_example,代码行数:7,代码来源:JQueryFormValueProviderTest.cs


示例2: SnakeCaseQueryValueProvider

 public SnakeCaseQueryValueProvider(
     BindingSource bindingSource, 
     IReadableStringCollection values, 
     CultureInfo culture)
     : base(bindingSource, values, culture)
 {
 }
开发者ID:Sorting,项目名称:SnakeCasify,代码行数:7,代码来源:SnakeCaseQueryValueProvider.cs


示例3: AddDefaultBinding

		/// <summary>
		/// Adds a default binding for the action. This will also add it to the regular bindings.
		/// </summary>
		/// <param name="binding">The BindingSource to add.</param>
		public void AddDefaultBinding( BindingSource binding )
		{
			if (binding == null)
			{
				return;
			}

			if (binding.BoundTo != null)
			{
				throw new InControlException( "Binding source is already bound to action " + binding.BoundTo.Name );
			}

			if (!defaultBindings.Contains( binding ))
			{
				defaultBindings.Add( binding );
				binding.BoundTo = this;
			}

			if (!regularBindings.Contains( binding ))
			{
				regularBindings.Add( binding );
				binding.BoundTo = this;

				if (binding.IsValid)
				{
					visibleBindings.Add( binding );
				}
			}
		}
开发者ID:ForsakenGS,项目名称:LostKids,代码行数:33,代码来源:PlayerAction.cs


示例4: GetChildBindingSources

    private static List<BindingSourceNode> GetChildBindingSources(
      IContainer container, BindingSource parent, BindingSourceNode parentNode)
    {
      List<BindingSourceNode> children = new List<BindingSourceNode>();

#if !WEBGUI
      foreach (System.ComponentModel.Component component in container.Components)
#else
      foreach (IComponent component in container.Components)
#endif
      {
        if (component is BindingSource)
        {
          BindingSource temp = component as BindingSource;
          if (temp.DataSource != null && temp.DataSource.Equals(parent))
          {
            BindingSourceNode childNode = new BindingSourceNode(temp);
            children.Add(childNode);
            childNode.Children.AddRange(GetChildBindingSources(container, temp, childNode));
            childNode.Parent = parentNode;
          }
        }
      }

      return children;
    }
开发者ID:transformersprimeabcxyz,项目名称:cslacontrib-MarimerLLC,代码行数:26,代码来源:BindingSourceHelper.cs


示例5: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        labelError.ModifyFg (StateType.Normal, new Gdk.Color(255, 0, 0));
        gridview.AutoGenerateColumns = false;
        gridview.Columns.Add (new GridViewColumn () {
            DataPropertyName = "ProductID", HeaderText = "ID" });
        gridview.Columns.Add (new GridViewColumn () {
            DataPropertyName = "ProductName", HeaderText = "Name", Width = 160 });
        var colPrice = new GridViewColumn () {
            DataPropertyName = "Price", HeaderText = "Price", Width = 60};
        colPrice.DefaultCellStyle.Format = "C2";
        gridview.Columns.Add (colPrice);
        gridview.Columns.Add (new GridViewColumn () {
            DataPropertyName = "Favourite", HeaderText = "Favourite"});

        products = new LinqNotifiedBindingList<Product>() {};
        bsrcProducts = new BindingSource (){DataSource = products};
        gridview.DataSource = bsrcProducts;

        entryID.DataBindings.Add (new Binding ("Text", bsrcProducts, "ProductID", true, DataSourceUpdateMode.OnPropertyChanged));
        entryName.DataBindings.Add (new Binding ("Text", bsrcProducts, "ProductName", true, DataSourceUpdateMode.OnPropertyChanged));
        spinPrice.DataBindings.Add (new Binding ("Value", bsrcProducts, "Price", true, DataSourceUpdateMode.OnPropertyChanged));
        checkFavourite.DataBindings.Add (new Binding ("Active", bsrcProducts, "Favourite", true, DataSourceUpdateMode.OnPropertyChanged));
        gridview.HeadersClickable = true;
    }
开发者ID:pzsysa,项目名称:gtk-sharp-forms,代码行数:28,代码来源:MainWindow.cs


示例6: BindingSourceValueProvider

        /// <summary>
        /// Creates a new <see cref="BindingSourceValueProvider"/>.
        /// </summary>
        /// <param name="bindingSource">
        /// The <see cref="ModelBinding.BindingSource"/>. Must be a single-source (non-composite) with
        /// <see cref="ModelBinding.BindingSource.IsGreedy"/> equal to <c>false</c>.
        /// </param>
        public BindingSourceValueProvider(BindingSource bindingSource)
        {
            if (bindingSource == null)
            {
                throw new ArgumentNullException(nameof(bindingSource));
            }

            if (bindingSource.IsGreedy)
            {
                var message = Resources.FormatBindingSource_CannotBeGreedy(
                    bindingSource.DisplayName,
                    nameof(BindingSourceValueProvider));
                throw new ArgumentException(message, nameof(bindingSource));
            }

            if (bindingSource is CompositeBindingSource)
            {
                var message = Resources.FormatBindingSource_CannotBeComposite(
                    bindingSource.DisplayName,
                    nameof(BindingSourceValueProvider));
                throw new ArgumentException(message, nameof(bindingSource));
            }

            BindingSource = bindingSource;
        }
开发者ID:huoxudong125,项目名称:Mvc,代码行数:32,代码来源:BindingSourceValueProvider.cs


示例7: GetEnumerableValueProvider

 protected override IEnumerableValueProvider GetEnumerableValueProvider(
     BindingSource bindingSource,
     IDictionary<string, string[]> values,
     CultureInfo culture)
 {
     var backingStore = new ReadableStringCollection(values);
     return new ReadableStringCollectionValueProvider(bindingSource, backingStore, culture);
 }
开发者ID:ryanbrandenburg,项目名称:Mvc,代码行数:8,代码来源:ReadableStringCollectionValueProviderTest.cs


示例8: GetEnumerableValueProvider

 protected override IEnumerableValueProvider GetEnumerableValueProvider(
     BindingSource bindingSource,
     Dictionary<string, StringValues> values,
     CultureInfo culture)
 {
     var backingStore = new QueryCollection(values);
     return new QueryStringValueProvider(bindingSource, backingStore, culture);
 }
开发者ID:phinq19,项目名称:git_example,代码行数:8,代码来源:QueryStringValueProviderTest.cs


示例9: Filter

 /// <inheritdoc />
 public virtual IValueProvider Filter(BindingSource bindingSource)
 {
     if (bindingSource.CanAcceptDataFrom(BindingSource))
     {
         return this;
     }
     else
     {
         return null;
     }
 }
开发者ID:RehanSaeed,项目名称:Mvc,代码行数:12,代码来源:BindingSourceValueProvider.cs


示例10: ModelValidationContext

 public ModelValidationContext(
     BindingSource bindingSource,
     [NotNull] IModelValidatorProvider validatorProvider,
     [NotNull] ModelStateDictionary modelState,
     [NotNull] ModelExplorer modelExplorer)
 {
     ModelState = modelState;
     ValidatorProvider = validatorProvider;
     ModelExplorer = modelExplorer;
     BindingSource = bindingSource;
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:11,代码来源:ModelValidationContext.cs


示例11: TestArrowDemo

        public void TestArrowDemo()
        {
            Console.WriteLine("\t-- Testing arrow demo --\n");

            Arrow<int, int>.func demo1 = x => x * x + 3;

            // Simple arrow test - 'test' is passed through the function 'demo1' to 'result'
            TestSourceObject source = new TestSourceObject();
            source.value = 3;
            BindingDestination<int> result = new BindingDestination<int>(0);
            Arrow<int, int> testArrow = new Arrow<int, int>(demo1);
            ArrowTestThing.Binding<int, int> testBinding = new ArrowTestThing.Binding<int, int>(source, "value", testArrow, result);

            // Change the value of 'test' randomly and assert that 'result' changes accordingly
            Console.WriteLine("Testing single binding...");

            Random random = new Random();

            for (int i = 0; i < 500; i++)
            {
                source.value = random.Next(0, 1000);
                Assert.AreEqual(result, demo1(source.value));
            }

            Console.WriteLine("Tests passed!");
            Console.WriteLine();


            Arrow<int, int>.func2 demo2 = (b, h) => (b * h) / 2;

            // Pair arrow test - 's1' and 's2' are treated as the breadth and height of a triangle,
            // and 'result' is now bound to the area of said triangle
            BindingSource<int> s1 = new BindingSource<int>(4);
            BindingSource<int> s2 = new BindingSource<int>(3);
            Arrow<int, int> dualArrow = new Arrow<int, int>(demo2);
            PairBinding<int, int> pairBinding = new PairBinding<int, int>(s1, s2, dualArrow, result);

            // Change the values of 's1' and 's2' randomly and assert that 'result' changes accordingly
            Console.WriteLine("Testing double binding...");

            random = new Random();

            for (int i = 0; i < 500; i++)
            {
                s1.Value = random.Next(0, 1000);
                s2.Value = random.Next(0, 1000);
                Assert.AreEqual(result, demo2(s1.Value, s2.Value));
            }

            Console.WriteLine("Tests passed!");
            Console.WriteLine();

            Console.WriteLine("All tests passed successfully.\n\n");
        }
开发者ID:animatinator,项目名称:C-sharp-arrows,代码行数:54,代码来源:Tester.cs


示例12: InitializeBindingSourceTree

    /// <summary>
    /// Sets up BindingSourceNode objects for all
    /// BindingSource objects related to the provided
    /// root source.
    /// </summary>
    /// <param name="container">
    /// Container for the components.
    /// </param>
    /// <param name="rootSource">
    /// Root BindingSource object.
    /// </param>
    /// <returns></returns>
    public static BindingSourceNode InitializeBindingSourceTree(
      IContainer container, BindingSource rootSource)
    {
      if (rootSource == null)
        throw new ApplicationException(Resources.BindingSourceNotProvided);

      _rootSourceNode = new BindingSourceNode(rootSource);
      _rootSourceNode.Children.AddRange(GetChildBindingSources(container, rootSource, _rootSourceNode));

      return _rootSourceNode;
    }
开发者ID:transformersprimeabcxyz,项目名称:cslacontrib-MarimerLLC,代码行数:23,代码来源:BindingSourceHelper.cs


示例13: GetEnumerableValueProvider

        protected override IEnumerableValueProvider GetEnumerableValueProvider(
            BindingSource bindingSource,
            Dictionary<string, StringValues> values,
            CultureInfo culture)
        {
            var emptyValueProvider =
                new JQueryFormValueProvider(bindingSource, new Dictionary<string, StringValues>(), culture);
            var valueProvider = new JQueryFormValueProvider(bindingSource, values, culture);

            return new CompositeValueProvider() { emptyValueProvider, valueProvider };
        }
开发者ID:phinq19,项目名称:git_example,代码行数:11,代码来源:CompositeValueProviderTest.cs


示例14: DataContextChangeSynchronizer

        public DataContextChangeSynchronizer(BindingSource bindingSource, BindingTarget bindingTarget, ITypeConverterProvider typeConverterProvider)
        {
            _bindingTarget = bindingTarget;
            Guard.ThrowIfNull(bindingTarget.Object, nameof(bindingTarget.Object));
            Guard.ThrowIfNull(bindingTarget.Property, nameof(bindingTarget.Property));
            Guard.ThrowIfNull(bindingSource.SourcePropertyPath, nameof(bindingSource.SourcePropertyPath));
            Guard.ThrowIfNull(bindingSource.Source, nameof(bindingSource.Source));
            Guard.ThrowIfNull(typeConverterProvider, nameof(typeConverterProvider));

            _bindingEndpoint = new TargetBindingEndpoint(bindingTarget.Object, bindingTarget.Property);
            _sourceEndpoint = new ObservablePropertyBranch(bindingSource.Source, bindingSource.SourcePropertyPath);
            _targetPropertyTypeConverter = typeConverterProvider.GetTypeConverter(bindingTarget.Property.PropertyType);
        }
开发者ID:healtech,项目名称:Perspex,代码行数:13,代码来源:DataContextChangeSynchronizer.cs


示例15: Create_WhenBindingSourceIsNotFromServices_ReturnsNull

        public void Create_WhenBindingSourceIsNotFromServices_ReturnsNull(BindingSource source)
        {
            // Arrange
            var provider = new ServicesModelBinderProvider();

            var context = new TestModelBinderProviderContext(typeof(IPersonService));
            context.BindingInfo.BindingSource = source;

            // Act
            var result = provider.GetBinder(context);

            // Assert
            Assert.Null(result);
        }
开发者ID:ymd1223,项目名称:Mvc,代码行数:14,代码来源:ServicesModelBinderProviderTest.cs


示例16: Equals

		public override bool Equals( BindingSource other )
		{
			if (other == null)
			{
				return false;
			}

			var bindingSource = other as MouseBindingSource;
			if (bindingSource != null)
			{
				return Control == bindingSource.Control;
			}

			return false;
		}
开发者ID:ForsakenGS,项目名称:LostKids,代码行数:15,代码来源:MouseBindingSource.cs


示例17: Equals

        public override bool Equals( BindingSource other )
        {
            if (other == null)
            {
                return false;
            }

            var bindingSource = other as KeyBindingSource;
            if (bindingSource != null)
            {
                return keyCombo == bindingSource.keyCombo;
            }

            return false;
        }
开发者ID:cjacobwade,项目名称:IndieBasketball,代码行数:15,代码来源:KeyBindingSource.cs


示例18: ProductFilter

        public ProductFilter(ref DataGridView dataGridView, string ExcludeColumns)
        {
            InitializeComponent();
            _dataGridView = dataGridView;
            excludeColumns = ExcludeColumns;

            try
            {
                data = dataGridView.DataSource as BindingSource;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Product Filter", "The datasource property of the containing DataGridView control " +
                    "must be set to a BindingSource.");
            }
        }
开发者ID:carlosgilf,项目名称:prettyjs,代码行数:16,代码来源:ProductFilter.cs


示例19: Filter

        /// <inheritdoc />
        public virtual IValueProvider Filter(BindingSource bindingSource)
        {
            if (bindingSource == null)
            {
                throw new ArgumentNullException(nameof(bindingSource));
            }

            if (bindingSource.CanAcceptDataFrom(BindingSource))
            {
                return this;
            }
            else
            {
                return null;
            }
        }
开发者ID:huoxudong125,项目名称:Mvc,代码行数:17,代码来源:BindingSourceValueProvider.cs


示例20: DictionaryBasedValueProvider

        /// <summary>
        /// Creates a new <see cref="DictionaryBasedValueProvider"/>.
        /// </summary>
        /// <param name="bindingSource">The <see cref="BindingSource"/> of the data.</param>
        /// <param name="values">The values.</param>
        public DictionaryBasedValueProvider(
            BindingSource bindingSource,
            IDictionary<string, object> values)
            : base(bindingSource)
        {
            if (bindingSource == null)
            {
                throw new ArgumentNullException(nameof(bindingSource));
            }

            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }

            _values = values;
        }
开发者ID:huoxudong125,项目名称:Mvc,代码行数:22,代码来源:DictionaryBasedValueProvider.cs



注:本文中的BindingSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BitArray类代码示例发布时间:2022-05-24
下一篇:
C# BindingMode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap