當前位置: 首頁>>代碼示例>>C#>>正文


C# ScrollView.SetBinding方法代碼示例

本文整理匯總了C#中Xamarin.Forms.ScrollView.SetBinding方法的典型用法代碼示例。如果您正苦於以下問題:C# ScrollView.SetBinding方法的具體用法?C# ScrollView.SetBinding怎麽用?C# ScrollView.SetBinding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Xamarin.Forms.ScrollView的用法示例。


在下文中一共展示了ScrollView.SetBinding方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GameMainView

		/// <summary>
		/// Initializes a new instance of the <see cref="WF.Player.GameMainView"/> class.
		/// </summary>
		/// <param name="gameMainViewModel">Game main view model.</param>
		public GameMainView(GameMainViewModel gameMainViewModel) : base()
		{
			BindingContext = gameMainViewModel;

			NavigationPage.SetBackButtonTitle(this, string.Empty);

			this.SetBinding(GameMainView.TitleProperty, GameMainViewModel.TitelPropertyName);

			#if __IOS__

			var toolbarMenu = new ToolbarItem(Catalog.GetString("Menu"), null, () => { //"IconMenu.png", () => {
				App.Click();
				var cfg = new WF.Player.Services.UserDialogs.ActionSheetConfig().SetTitle(Catalog.GetString("Game Menu"));
				cfg.Add(Catalog.GetString("Save"), () => ((GameMainViewModel)BindingContext).HandleMenuAction(this, Catalog.GetString("Save")));
				cfg.Add(Catalog.GetString("Quit"), () => ((GameMainViewModel)BindingContext).HandleMenuAction(this, Catalog.GetString("Quit")));
				cfg.Cancel = new WF.Player.Services.UserDialogs.ActionSheetOption(Catalog.GetString("Cancel"), App.Click);
				DependencyService.Get<WF.Player.Services.UserDialogs.IUserDialogs>().ActionSheet(cfg);
			});
			this.ToolbarItems.Add (toolbarMenu);

			#endif

			#if __ANDROID__

			var toolbarSave = new ToolbarItem(Catalog.GetString("Save"), "", () =>
				{ 
					App.Click();
					((GameMainViewModel)BindingContext).HandleMenuAction(this, Catalog.GetString("Save")); 
				}) {
				Order = ToolbarItemOrder.Secondary,
			};
			ToolbarItems.Add(toolbarSave);
			var toolbarQuit = new ToolbarItem(Catalog.GetString("Quit"), "", () =>
				{ 
					App.Click();
					((GameMainViewModel)BindingContext).HandleMenuAction(this, Catalog.GetString("Quit")); 
				}) {
				Order = ToolbarItemOrder.Secondary,
			};
			ToolbarItems.Add(toolbarQuit);

			#endif

			var grid = new Grid() 
				{
					RowSpacing = 0,
					HorizontalOptions = LayoutOptions.FillAndExpand,
					VerticalOptions = LayoutOptions.FillAndExpand,
				};

			grid.RowDefinitions = new RowDefinitionCollection 
				{
					new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
					new RowDefinition { Height = 60 }
				};

			grid.ColumnDefinitions = new ColumnDefinitionCollection 
				{
					new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
				};

			var bottomLayout = new StackLayout() 
				{
					Spacing = 0,
					Orientation = StackOrientation.Vertical,
					HorizontalOptions = LayoutOptions.FillAndExpand,
					VerticalOptions = LayoutOptions.Fill,
				};

			#if __IOS__

			// Dark grey line on iOS
			var line = new BoxView () 
				{
					BackgroundColor = App.Colors.IsDarkTheme ? Color.FromRgb(0x26, 0x26, 0x26) : Color.FromRgb (0xAE, 0xAE, 0xAE),
					HeightRequest = 0.5f,
					HorizontalOptions = LayoutOptions.FillAndExpand,
				};

			bottomLayout.Children.Add(line);

			#endif

			TapGestureRecognizer tapRecognizer;

			var buttonLayout = new StackLayout() 
				{
					Orientation = StackOrientation.Horizontal,
					BackgroundColor = App.Colors.Bar,
					HeightRequest = 60,
					MinimumHeightRequest = 60,
					HorizontalOptions = LayoutOptions.FillAndExpand,
				};

			// Overview button
			this.buttonOverview = new GameToolBarButton("IconOverview.png") 
//.........這裏部分代碼省略.........
開發者ID:Surfoo,項目名稱:WF.Player,代碼行數:101,代碼來源:GameMainView.cs


注:本文中的Xamarin.Forms.ScrollView.SetBinding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。