2017-05-24 25 views
0

我已經改名爲的InitializeComponent在這方面

OSCCellEdit.xaml-> OSCCell.xaml.cs

using System; 
using Xamarin.Forms; 

namespace MyApp 
{ 
    public partial class OSCCellEditor : ContentPage 
    { 
     public OSCCellEditor() 
     { 
      InitializeComponent(); 
     } 

using System; 
using Xamarin.Forms; 

namespace MyApp 
{ 
    public partial class OSCCellEdit : ContentPage 
    { 
     public OSCCellEdit() 
     { 
      InitializeComponent(); 
     } 

而且

不可用

OSCCellEd it.xaml從

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyApp.OSCCellEditor" Title="{Binding Name}"> 

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyApp.OSCCellEdit" Title="{Binding Name}"> 

現在,編譯器告訴我: 「 'InitalizeComponent' 這個名字是不是在當前情況下可用」。

有人能告訴我爲什麼會發生這種情況,以及如何解決這個問題?

非常感謝。

回答

0

您是否更改.csproj文件中的Complier依賴項?

<Compile Include="OSCCell.xaml.cs"> 
    <DependentUpon>OSCCell.xaml</DependentUpon> 
</Compile> 

它應該是這樣的xaml.cs依賴XAML文件確保名稱在您的項目相匹配。

如果它仍然不起作用刪除bin和obj文件並再次構建。

+0

是的,我做到了。事實證明,我必須在重命名對話框中激活「包含字符串」選項。 – tmighty

相關問題