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

C# ContentPage类代码示例

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

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



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

示例1: Init

		protected override void Init ()
		{
			_lblCount = new Label { Text = _count.ToString (), AutomationId = "lblCount" };
			_btnOpen = new Button { Text = "Open", AutomationId = "btnOpen", 
				Command = new Command (() => {
					IsPresented = true;
				})
			};
			_btnClose = new Button { Text = "Close", AutomationId = "btnClose", 
				Command = new Command (() => {
					IsPresented = false;
				})
			};

			Master = new ContentPage {
				Title = "Master",
				Content = new StackLayout { Children = { _lblCount, _btnClose } }
			};

			Detail = new NavigationPage (new ContentPage { Content = _btnOpen });
			IsPresentedChanged += (object sender, EventArgs e) => {
				_count++;
				_lblCount.Text = _count.ToString();
			};
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:25,代码来源:Bugzilla32230.cs


示例2: TestCase001

		public void TestCase001 ()
		{
			var xaml = @"<?xml version=""1.0"" encoding=""UTF-8"" ?>
			<ContentPage
			xmlns=""http://xamarin.com/schemas/2014/forms""
			xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
			xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests""
			Title=""Home"">
				<local:TestCases.InnerView>
					<Label x:Name=""innerView""/>
				</local:TestCases.InnerView>
				<ContentPage.Content>
					<Grid RowSpacing=""9"" ColumnSpacing=""6"" Padding=""6,9"" VerticalOptions=""Fill"" HorizontalOptions=""Fill"" BackgroundColor=""Red"">
						<Grid.Children>
							<Label x:Name=""label0""/>
							<Label x:Name=""label1""/>
							<Label x:Name=""label2""/>
							<Label x:Name=""label3""/>
						</Grid.Children>
					</Grid>
				</ContentPage.Content>
			</ContentPage>";
			var contentPage = new ContentPage ().LoadFromXaml (xaml);
			var label0 = contentPage.FindByName<Label> ("label0");
			var label1 = contentPage.FindByName<Label> ("label1");

			Assert.NotNull (GetInnerView (contentPage));
//			Assert.AreEqual ("innerView", GetInnerView (contentPage).Name);
			Assert.AreEqual (GetInnerView (contentPage), ((Forms.Internals.INameScope)contentPage).FindByName ("innerView"));
			Assert.NotNull (label0);
			Assert.NotNull (label1);
			Assert.AreEqual (4, contentPage.Content.Descendants ().Count ());
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:33,代码来源:TestCases.cs


示例3: RootMDPNavigationContentPage

		public RootMDPNavigationContentPage (string hierarchy) 
		{
			AutomationId = hierarchy + "PageId";

			Master = new ContentPage {
				Title = "Testing 123",
				Content = new StackLayout {
					Children = {
						new Label { Text = "Master" },
						new AbsoluteLayout {
							BackgroundColor = Color.Red,
							VerticalOptions = LayoutOptions.FillAndExpand,
							HorizontalOptions = LayoutOptions.FillAndExpand
						},
						new Button { Text = "Button" }
					}
				}
			};

			Detail = new NavigationPage (new ContentPage {
				Title = "Md->Nav->Con",
				Content = new SwapHierachyStackLayout (hierarchy)
			});

		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:25,代码来源:RootMDPNavigationContentPage.cs


示例4: TestNavigationImplPop

		public async Task TestNavigationImplPop ()
		{
			NavigationPage nav = new NavigationPage ();
			
			Label child = new Label ();
			Page childRoot = new ContentPage {Content = child};

			Label child2 = new Label ();
			Page childRoot2 = new ContentPage {Content = child2};
			
			await nav.Navigation.PushAsync (childRoot);
			await nav.Navigation.PushAsync (childRoot2);

			bool fired = false;
			nav.Popped += (sender, e) => fired = true;
			var popped = await nav.Navigation.PopAsync ();

			Assert.True (fired);
			Assert.AreSame (childRoot, nav.CurrentPage);
			Assert.AreEqual (childRoot2, popped);

			await nav.PopAsync ();
			var last = await nav.Navigation.PopAsync ();

			Assert.IsNull (last);
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:26,代码来源:NavigationUnitTest.cs


示例5: BindData

    /// <summary>
    /// Bind data to the fields 
    /// </summary>
    protected void BindData()
    {
        ContentPageAdmin pageAdmin = new ContentPageAdmin();
        ContentPage contentPage = new ContentPage();

        if (ItemId > 0)
        {
            contentPage = pageAdmin.GetPageByID(ItemId);

            //set fields
            lblTitle.Text += contentPage.Title;
            txtTitle.Text = contentPage.Title;
            txtSEOMetaDescription.Text = contentPage.SEOMetaDescription;
            txtSEOMetaKeywords.Text = contentPage.SEOMetaKeywords;
            txtSEOTitle.Text = contentPage.SEOTitle;
            txtSEOUrl.Text = contentPage.SEOURL;

            //get content
            ctrlHtmlText.Html = pageAdmin.GetPageHTMLByName(contentPage.Name);
        }
        else
        {
            //nothing to do here
        }
    }
开发者ID:daniela12,项目名称:gooptic,代码行数:28,代码来源:pages_edit.aspx.cs


示例6: Init

		protected override void Init ()
		{

			var showAlertBtn = new Button { Text = "DisplayAlert" };
			var showActionSheetBtn = new Button { Text = "DisplayActionSheet" };

			var master = new ContentPage
			{
				Title = "Master",
				Content = new StackLayout
				{
					VerticalOptions = LayoutOptions.Center,
					Children = {
						showAlertBtn,
						showActionSheetBtn
					}
				}
			};

			Master = master;

			MasterBehavior = MasterBehavior.Popover;

			Detail = new ContentPage {
				Content = new Label { Text = "Details", HorizontalOptions =
					LayoutOptions.Center, VerticalOptions = LayoutOptions.Center
				}
			};

			showAlertBtn.Clicked += (s, e) => DisplayAlert("Title","Message", "Cancel");
			showActionSheetBtn.Clicked += (s, e) => DisplayActionSheet ("Title", "Cancel", null, "Button1", "Button2", "Button3");
			
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:33,代码来源:Bugzilla27698.cs


示例7: OnMenuSelected

		void OnMenuSelected (SliderMenuItem menu)
		{
			Debug.WriteLine (IsPresented);

			IsPresented = false;	

			if (menu == null || menu == _selectedMenuItem) {
				return;
			}
			_displayPage = null;

			if (menu.TargetType.Equals (typeof(SignOutPage))) {
				HandleSignOut ();
				return;
			}
			_displayPage = (ContentPage)Activator.CreateInstance (menu.TargetType);
			Detail = new NavigationPage (_displayPage);
		
			if (_selectedMenuItem != null) {
				_selectedMenuItem.IsSelected = false;
			}

			_selectedMenuItem = menu;
			_selectedMenuItem.IsSelected = true;
		}
开发者ID:cosullivan,项目名称:Xamarin.Forms,代码行数:25,代码来源:Issue2961.cs


示例8: Edit

        public ActionResult Edit(int id = 0, string message = "")
        {
            // Load the page from the database
            ContentPage page = new ContentPage();
            if (id > 0) {
                page = ContentManagement.GetPage(id);
            }
            ViewBag.page = page;

            // Try override 'page' with our page from TempData, in case there was a fucking error while saving. Fuck that error!!
            ContentPage errPage = (ContentPage)TempData["page"];
            if (errPage != null) {
                ViewBag.page = errPage;
            }
            ViewBag.message = TempData["error"];

            // Build out the listing of parent pages i.e. pages who list this page in there menu
            ViewBag.parent_page = page.getParent();

            // Build out the listing of subpages i.e. pages who list this page as their parent page
            ViewBag.sub_pages = page.getSubpages();

            // We need to pass in the fixed_titles so we know when we can't allow the user to edit the title
            string[] fixed_pages = ContentManagement.fixed_pages;
            ViewBag.fixed_pages = fixed_pages;

            return View();
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:28,代码来源:ContentManagerController.cs


示例9: RootTabbedNavigationContentPage

		public RootTabbedNavigationContentPage (string hierarchy)
		{
			AutomationId = hierarchy + "PageId";

			var tabOne = new NavigationPage (new ContentPage {
				Title = "Nav title",
				Content = new SwapHierachyStackLayout (hierarchy)
			}) { Title = "Tab 123", };

			var tabTwo = new ContentPage {
				Title = "Testing 345",
				Content = new StackLayout {
					Children = {
						new Label { Text = "Hello" },
						new AbsoluteLayout {
							BackgroundColor = Color.Red,
							VerticalOptions = LayoutOptions.FillAndExpand,
							HorizontalOptions = LayoutOptions.FillAndExpand
						},
						new Button { Text = "Button" },
					}
				}
			};

			Children.Add (tabOne);
			Children.Add (tabTwo);
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:27,代码来源:RootTabbedNavigationContentPage.cs


示例10: Run

    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the ContentService.
      ContentService contentService =
          (ContentService) user.GetService(DfpService.v201508.ContentService);

      // Create a statement to get all content.
      StatementBuilder statementBuilder = new StatementBuilder()
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

      // Set default for page.
      ContentPage page = new ContentPage();

      try {
        do {
          // Get content by statement.
          page = contentService.getContentByStatement(statementBuilder.ToStatement());

          if (page.results != null) {
            int i = page.startIndex;
            foreach (Content content in page.results) {
              Console.WriteLine("{0}) Content with ID \"{1}\", name \"{2}\", and status \"{3}\" " +
                  "was found.", i, content.id, content.name, content.status);
              i++;
            }
          }
          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);

        Console.WriteLine("Number of results found: " + page.totalResultSetSize);
      } catch (Exception e) {
        Console.WriteLine("Failed to get all content. Exception says \"{0}\"", e.Message);
      }
    }
开发者ID:markgmarkg,项目名称:googleads-dotnet-lib,代码行数:38,代码来源:GetAllContent.cs


示例11: SimpleApp

		public SimpleApp()
		{
			var label = new Label { VerticalOptions = LayoutOptions.CenterAndExpand };

			if (Current.Properties.ContainsKey("LabelText"))
			{
				label.Text = (string)Current.Properties["LabelText"] + " Restored!";
				Debug.WriteLine("Initialized");
			}
			else
			{
				Current.Properties["LabelText"] = "Wowza";
				label.Text = (string)Current.Properties["LabelText"] + " Set!";
				Debug.WriteLine("Saved");
			}

			MainPage = new ContentPage
			{
				Content = new StackLayout
				{
					Children =
					{
						label
					}
				}
			};

			SerializeProperties();
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:29,代码来源:SimpleApp.cs


示例12: ConverterIsInvoked

		public void ConverterIsInvoked ()
		{
			var xaml = @"
<ContentPage 							
xmlns=""http://xamarin.com/schemas/2014/forms"" 
							xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
							xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests"">

<ContentPage.Resources>
<ResourceDictionary>
<local:SeverityColorConverter x:Key=""SeverityColorConverter"" />
</ResourceDictionary>
</ContentPage.Resources>
				<Label Text=""{Binding value, StringFormat='{0}'}"" 
					WidthRequest=""50"" 
					TextColor=""Black""
					x:Name=""label""
					BackgroundColor=""{Binding Severity, Converter={StaticResource SeverityColorConverter}}""
					XAlign=""Center"" YAlign=""Center""/>
</ContentPage>";

			var layout = new ContentPage ().LoadFromXaml (xaml);
			layout.BindingContext = new {Value = "Foo", Severity = "Bar"};
			var label = layout.FindByName<Label> ("label");
			Assert.AreEqual (Color.Blue, label.BackgroundColor);
			Assert.AreEqual (1, SeverityColorConverter.count);
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:27,代码来源:Issue1549.cs


示例13: Index

        public ActionResult Index(string content, string subject)
        {
            if (!Application.IsAuthenticated) {
                ViewBag.Header = "Please Log In";
                ViewBag.Message = "Your authorization is not valid for this type of operation";
                return View("Message", "_LayoutGuest");
            }

            try
            {
                ContentPage page = new ContentPage();
                page.Name = subject;
                page.PageContent = content;
                page.DateModified = DateTime.Now;
                page.AdminID = Application.AdminID;
                page.CmsTypeID = 2;
                Application.Db.AddToContentPages(page);
                Application.Db.SaveChanges();
                return RedirectToAction("index");
            }
            catch
            {
                return View();
            }
        }
开发者ID:haroldocampo,项目名称:KChOTS_OnlineTrainingSystem,代码行数:25,代码来源:PageController.cs


示例14: RootMDPNavigationTabbedContentPage

		public RootMDPNavigationTabbedContentPage (string hierarchy)
		{
			AutomationId = hierarchy + "PageId";


			var tabbedPage = new TabbedPage ();

			var firstTab = new ContentPage {
				//BackgroundColor = Color.Yellow,
				Title = "Testing 123",
				Content = new SwapHierachyStackLayout (hierarchy)
			};

			tabbedPage.Children.Add (firstTab);

			NavigationPage.SetHasNavigationBar (firstTab, false);

			Detail = new NavigationPage (tabbedPage);
			Master = new NavigationPage (new ContentPage {
				Title = "Testing 345",
				Content = new StackLayout {
					Children = {
						new Label { Text = "Hello" },
						new AbsoluteLayout {
							BackgroundColor = Color.Red,
							VerticalOptions = LayoutOptions.FillAndExpand,
							HorizontalOptions = LayoutOptions.FillAndExpand
						},
						new Button { Text = "Button" }
					}
				}
			}) { 
				Title = "Testing 345"
			};
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:35,代码来源:RootMDPNavigationTabbedContentPage.cs


示例15: BindingCanNotBeReused

		public void BindingCanNotBeReused()
		{
			string xaml = @"<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
						 xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						 x:Class=""Xamarin.Forms.Controls.Issue1545"">
						<ListView x:Name=""List"" ItemsSource=""{Binding}"">
							<ListView.ItemTemplate>
								<DataTemplate>
									<TextCell Text=""{Binding}"" />
								</DataTemplate>
							</ListView.ItemTemplate>
						</ListView>
				</ContentPage>";

			ContentPage page = new ContentPage().LoadFromXaml (xaml);

			var items = new[] { "Fu", "Bar" };
			page.BindingContext = items;

			ListView lv = page.FindByName<ListView> ("List");
			
			TextCell cell = (TextCell)lv.TemplatedItems.GetOrCreateContent (0, items[0]);
			Assert.That (cell.Text, Is.EqualTo ("Fu"));
			
			cell = (TextCell)lv.TemplatedItems.GetOrCreateContent (1, items[1]);
			Assert.That (cell.Text, Is.EqualTo ("Bar"));
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:27,代码来源:Issue1545.cs


示例16: UseTypeConverters

		public void UseTypeConverters ()
		{
			var xaml = @"
			<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
             xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
             Title=""Grid Demo Page"">
			  <ContentPage.Padding>
			    <OnPlatform x:TypeArguments=""Thickness"">
			      <OnPlatform.iOS>
			        0, 20, 0, 0
			      </OnPlatform.iOS>
			      <OnPlatform.Android>
			        0, 0, 10, 0
			      </OnPlatform.Android>
			      <OnPlatform.WinPhone>
			        0, 20, 0, 20
			      </OnPlatform.WinPhone>
			    </OnPlatform>
			  </ContentPage.Padding>  
			</ContentPage>";

			ContentPage layout;

			Device.OS = TargetPlatform.iOS;
			layout = new ContentPage ().LoadFromXaml (xaml);
			Assert.AreEqual (new Thickness (0, 20, 0, 0), layout.Padding);

			Device.OS = TargetPlatform.Android;
			layout = new ContentPage ().LoadFromXaml (xaml);
			Assert.AreEqual (new Thickness (0, 0, 10, 0), layout.Padding);

			Device.OS = TargetPlatform.WinPhone;
			layout = new ContentPage ().LoadFromXaml (xaml);
			Assert.AreEqual (new Thickness (0, 20, 0, 20), layout.Padding);
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:35,代码来源:OnPlatformTests.cs


示例17: BindData

    /// <summary>
    /// Bind data to the fields 
    /// </summary>
    protected void BindData()
    {
        ContentPageAdmin pageAdmin = new ContentPageAdmin();
        ContentPage contentPage = new ContentPage();

        if (ItemId > 0)
        {
            contentPage = pageAdmin.GetPageByID(ItemId);

            //set fields
            txtName.Text = contentPage.Name.Trim();
            txtSEOMetaDescription.Text = contentPage.SEOMetaDescription;
            txtSEOMetaKeywords.Text = contentPage.SEOMetaKeywords;
            txtSEOTitle.Text = contentPage.SEOTitle;
            txtSEOUrl.Text = contentPage.SEOURL;
            txtTitle.Text = contentPage.Title;
            ddlPageTemplateList.SelectedValue = contentPage.MasterPage;

            //get content
            ctrlHtmlText.Html = pageAdmin.GetPageHTMLByName(contentPage.Name);
            if (contentPage.Name.Contains("Home"))
            {
                pnlSEOURL.Visible = false;
            }
        }
        else
        {
           //nothing to do here
        }
    }
开发者ID:daniela12,项目名称:gooptic,代码行数:33,代码来源:Add.aspx.cs


示例18: EditContentViewModel

        public EditContentViewModel(int id)
        {
            using (var context = new DataContext())
            {
                ThePage = context.ContentPages.Where(x => x.ContentPageId == id).Take(1).FirstOrDefault();

                // If we are editing a draft, we actually need to be editing the parent page, but keep the drafts contents (html, css, meta, etc).
                // To accomplish this, we can simply change the id of the page we're editing in memory, to the parent page.
                BasePageId = ThePage.IsRevision ? Convert.ToInt32(ThePage.ParentContentPageId) : ThePage.ContentPageId;

                var userName = Membership.GetUser().UserName;
                UseWordWrap = context.Users.FirstOrDefault(x => x.Username == userName).ContentAdminWordWrap;

                SiteUrl = HTTPUtils.GetFullyQualifiedApplicationPath();

                // Take care of any legacy pages that don't have a publish date associated
                if (ThePage.PublishDate == null)
                {
                    ThePage.PublishDate = DateTime.Now;
                    context.SaveChanges();
                }

                // Take care of any legacy pages where Unparsed html was not saved
                if (String.IsNullOrEmpty(ThePage.HTMLUnparsed) && !String.IsNullOrEmpty(ThePage.HTMLContent))
                {
                    ThePage.HTMLUnparsed = ThePage.HTMLContent;
                }

                // Set a permalink if one hasn't been created / legacy support for DisplayName
                if (String.IsNullOrEmpty(ThePage.Permalink))
                {
                    ThePage.Permalink = ContentUtils.GetFormattedUrl(ThePage.DisplayName);
                    context.SaveChanges();
                }

                // Set Page Title if one hasn't been created / legacy support for DisplayName
                if (String.IsNullOrEmpty(ThePage.Title))
                {
                    ThePage.Title = ThePage.DisplayName;
                    context.SaveChanges();
                }

                // Check to see if there is a newer version available
                var newerVersion = context.ContentPages.Where(x => (x.ParentContentPageId == BasePageId || x.ContentPageId == BasePageId) && x.PublishDate > ThePage.PublishDate && x.ContentPageId != ThePage.ContentPageId).OrderByDescending(x => x.PublishDate).FirstOrDefault();

                if (newerVersion != null)
                {
                    IsNewerVersion = true;
                    NewerVersionId = newerVersion.ContentPageId;
                }

                Templates = new ContentTemplates().Templates;

                Revisions = context.ContentPages.Where(x => x.ParentContentPageId == BasePageId || x.ContentPageId == BasePageId).OrderByDescending(x => x.PublishDate).ToList();

                // Get list of schemas for drop down
                Schemas = context.Schemas.ToList();
            }
        }
开发者ID:marciocamello,项目名称:dirigo-edge,代码行数:59,代码来源:EditContentViewModel.cs


示例19: TestMasterSetNull

		public void TestMasterSetNull ()
		{
			MasterDetailPage page = new MasterDetailPage ();
			var child = new ContentPage {Content = new Label (), Title = "Foo"};
			page.Master = child;

			Assert.Throws<ArgumentNullException> (() => { page.Master = null; });
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:8,代码来源:MasterDetailFormUnitTests.cs


示例20: GetAboutPage

        public ContentPage GetAboutPage()
        {
            var page = new ContentPage();
            page.Title = "About us";
            page.Description = "This page introduces us";

            return page;
        }
开发者ID:Wangweizhou,项目名称:Visual-Studio-Experiments,代码行数:8,代码来源:ContentPagesModel.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ContentPost类代码示例发布时间:2022-05-24
下一篇:
C# ContentManager类代码示例发布时间: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