【发布时间】:2018-08-19 03:08:12
【问题描述】:
今天我遇到了一些问题。请帮帮我。
我在 IOS 和 Android 上创建了一个跨平台应用程序。所以我试图访问我的 MainPage 控件表单 .cs 文件,但我不能。这是提供的代码。
MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Movies"
x:Class="Movies.MainPage">
<TableView x:Name="mainTable">
<TableSection>
<ViewCell>
<ViewCell.View>
<Label Text="Hello"></Label>
</ViewCell.View>
</ViewCell>
</TableSection>
</TableView>
</ContentPage>
MainPage.xaml.cs
using Xamarin.Forms;
namespace Movies
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
mainTable.
}
}
}
https://i.imgur.com/OKO3yYc.png
项目运行成功。
https://i.imgur.com/ondjVkP.png
我尝试在 VS 安装程序中重建甚至恢复 VS17。 this.mainTable 也不起作用。
【问题讨论】:
-
this.mainTable 有效吗?
-
不,不是。我尝试在 VS 安装程序中重建甚至恢复 VS17
-
但是代码可以编译吗?如果你写 Console.WriteLine(mainTable.ToString());它会编译并写一些东西吗?
-
用 Console.WriteLine(mainTable.ToString()); 编译。奇怪的。输出“Xamarin.Forms.TableView”
-
它正在编译,我可以使用这个控件,谢谢,但是对于我作为 Xamarin 表单开发的初学者来说,没有 IntelliSense 真的很难做到。有人可以帮忙吗?
标签: xamarin xamarin.forms