当前位置: 首页>>代码示例>>C#>>正文


C# RowDefinition.SetBinding方法代码示例

本文整理汇总了C#中RowDefinition.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# RowDefinition.SetBinding方法的具体用法?C# RowDefinition.SetBinding怎么用?C# RowDefinition.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RowDefinition的用法示例。


在下文中一共展示了RowDefinition.SetBinding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ColAndRowDefinitionsAreActuallyBindable

		//https://bugzilla.xamarin.com/show_bug.cgi?id=31608
		public void ColAndRowDefinitionsAreActuallyBindable ()
		{
			var rowdef = new RowDefinition ();
			rowdef.SetBinding (RowDefinition.HeightProperty, "Height");
			var grid = new Grid {
				RowDefinitions = new RowDefinitionCollection { rowdef },
			};
			Assert.AreEqual (RowDefinition.HeightProperty.DefaultValue, rowdef.Height);
			grid.BindingContext = new {Height = 32};
			Assert.AreEqual (new GridLength(32), rowdef.Height);
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:12,代码来源:GridTests.cs

示例2: ChangingRowHeightViaBindingTriggersRedraw

		//https://bugzilla.xamarin.com/show_bug.cgi?id=31967
		public void ChangingRowHeightViaBindingTriggersRedraw ()
		{
			var rowdef = new RowDefinition ();
			rowdef.SetBinding (RowDefinition.HeightProperty, "Height");
			var grid = new Grid {
//				RowDefinitions = new RowDefinitionCollection {
//					new RowDefinition { Height = GridLength.Auto },
//					rowdef
//				},
				RowSpacing = 0,
				Platform = new UnitPlatform (),
				IsPlatformEnabled = true,
			};
			grid.RowDefinitions.Add (new RowDefinition { Height = GridLength.Auto });
			grid.RowDefinitions.Add (rowdef);

			var label0 = new Label { IsPlatformEnabled = true };
			Grid.SetRow (label0, 0);
			var label1 = new Label { IsPlatformEnabled = true };
			Grid.SetRow (label1, 1);

			grid.BindingContext = new {Height = 0};
			grid.Children.Add (label0);
			grid.Children.Add (label1);

			Assert.AreEqual (new SizeRequest (new Size (100, 20), new Size (0, 20)), grid.GetSizeRequest (double.PositiveInfinity, double.PositiveInfinity));
			grid.BindingContext = new {Height = 42};
			Assert.AreEqual (new SizeRequest (new Size (100, 62), new Size (0, 62)), grid.GetSizeRequest (double.PositiveInfinity, double.PositiveInfinity));
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:30,代码来源:GridTests.cs

示例3: CreateDefinitions

 private void CreateDefinitions( )
 {
     Debug.WriteLine($"{GameBoard.ActualHeight} x {GameBoard.ActualWidth}");
     var rows = App.GameModel.Rows;
     var columns = App.GameModel.Columns;
     for(var i = 1; i <= rows; i++)
     {
         var heightBinding = new Binding("ActualHeight")
         {
             Converter = new SizeToGridLengthConverter(),
             Source = GameBoard,
             ConverterParameter = "Height"
         };
         var r = new RowDefinition();
         r.SetBinding(RowDefinition.HeightProperty, heightBinding);
         GameBoard.RowDefinitions.Add(r);
     }
     for(var i = 1; i <= columns; i++)
     {
         var widthBinding = new Binding("ActualWidth")
         {
             Converter = new SizeToGridLengthConverter(),
             Source = GameBoard,
             ConverterParameter = "Width"
         };
         var c = new ColumnDefinition();
         c.SetBinding(ColumnDefinition.WidthProperty, widthBinding);
         GameBoard.ColumnDefinitions.Add(c);
     }
 }
开发者ID:Chr1st1anSzech,项目名称:Wortspiel,代码行数:30,代码来源:MainWindow.xaml.cs


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