2016-06-29 7 views
11

मेरे पास यह कोड है और मुझे यह त्रुटि मिलती है, मैं इसे कैसे ठीक कर सकता हूं?'System.String' प्रकार का ऑब्जेक्ट 'Xamarin.Forms.View' टाइप करने के लिए परिवर्तित नहीं किया जा सकता है

'System.String' प्रकार का ऑब्जेक्ट 'Xamarin.Forms.View' प्रकार में परिवर्तित नहीं किया जा सकता है।

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" x:Class="Project1.Page1"> 
    <ContentPage.Content> 
     <StackLayout> 
     <Label Text="Text"></Label> 
     Some text here 
     <Editor Text="I am an Editor" /> 
     </StackLayout> 
    </ContentPage.Content> 
    </ContentPage> 
+1

के लिए पाठ बदलने कृपया अपना पूरा एक्सएएमएल –

+0

ओके अपडेट करें घ। –

+0

क्या आप अपने पेज 1.xaml.cs पर ContentPage से विरासत में हैं? –

उत्तर

18

जब मैं सादा पाठ StackLayout के अंदर है कि हटाया यह समस्या को हल किया है। इसलिए मैंने इसे एक लेबल घटक में बदल दिया है और टेक्स्ट प्रॉपर्टी में सादा पाठ डाल दिया है।

<?xml version="1.0" encoding="UTF-8"?> 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Project1.Page1"> 
    <ContentPage.Content> 
    <StackLayout> 
     <Label Text="Text"></Label> 
     <Editor Text="I am an Editor" /> 
    </StackLayout> 
    </ContentPage.Content> 
</ContentPage> 
+2

आह ... समाधान खोजने की कोशिश करने के 2 घंटों के बाद, मैंने देखा कि 'स्टैकलाउट' के अंदर एक 'चरित्र के कारण मुझे यह त्रुटि मिल रही थी ... धन्यवाद! –

2

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" x:Class="Project1.Page1"> 
    <ContentPage.Content> 
     <StackLayout> 
     <Label Text="Text"></Label> 
     <!--Some text here--> 
     <Editor Text="I am an Editor" /> 
     </StackLayout> 
    </ContentPage.Content> 
    </ContentPage> 

प्रयास करें, इस तरह से टिप्पणी

सादर

संबंधित मुद्दे

 संबंधित मुद्दे