2014-06-24 8 views
9

में एक्समरिन फॉर्म टेबल व्यू कोई भी मुझे बता सकता है कि एक्सएएमएल में टेबलव्यू कैसे सेट अप करें। कोशिश की -एक्सएएमएल

<?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="XYZ.Forms.HardCodedCells"> 
    <ContentPage.Content> 
    <StackLayout> 
    <Label Text="Above TableView"></Label> 
    <TableView> 
     <TableRoot> 
      <TableSection Title="Test">  
       <TextCell Text="Test"></TextCell> 
      </TableSection> 
     </TableRoot> 
    </TableView> 
    </StackLayout> 
    </ContentPage.Content> 
</ContentPage> 

यह "प्रयास" स्क्रीन पर खाली हो जाता है?

और अगर मैं अतिरिक्त कोशिकाओं जोड़ने के लिए, कहते हैं कि एक EntryCell, TableSection मैं पाने के लिए -

"ऑब्जेक्ट प्रकार Xamarin.Forms.TextCell प्रकार लक्षित करने के लिए नहीं बदला जा सकता: Xamarin.Forms.View"

एक तरफ के रूप में, मैं प्रत्येक फॉर्म तत्व के लिए वैध XAML वाक्यविन्यास कहां देख सकता हूं?

उत्तर

17

मैं TableRoot लेकिन TableView.Root

एक के रूप में एक तरफ का इस्तेमाल किया है नहीं करना चाहिए, यहाँ सही कोड है और यह भी कि कैसे आप tableview 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="XYZ.Forms.HardCodedCells"> 
    <ContentPage.Content> 
    <StackLayout> 
    <Label Text="Above TableView"></Label> 
    <TableView> 
     <TableView.Root> 
      <TableSection Title="Test">  
       <EntryCell Label="EntryCell"></EntryCell> 
       <TextCell Text="Test"></TextCell> 
       <ViewCell> 
        <ViewCell.View> 
         <StackLayout Orientation="Horizontal" > 
         <BoxView Color="Red"></BoxView> 
         <StackLayout> 
          <Label Text="News Item 1"></Label> 
          <Label Text="News URL 1"></Label> 
         </StackLayout> 
         <BoxView x:Name="boxView" Color="Blue" ></BoxView> 
         </StackLayout>  
        </ViewCell.View> 
       </ViewCell> 
      </TableSection> 
     </TableView.Root> 
    </TableView> 
    </StackLayout> 
    </ContentPage.Content> 
</ContentPage> 
+0

@StephaneDelcroix और पोस्टर: इसलिए मैं सही एक्सएएमएल के बारे में उलझन में हूं जब मैं कुछ वर्गों के साथ 'टेबल व्यू' चाहता हूं। क्या मुझे ' 'करना चाहिए या मुझे' ' भाग की आवश्यकता नहीं है या मुझे ' 'भाग की आवश्यकता नहीं है? – hvaughan3

+0

hi @ hvaughan3 - मैंने अभी तक ज़ैमरिन फॉर्मों का पुनरीक्षण नहीं किया है क्योंकि मैंने यह लिखा था जब यह बहुत जल्दी वी 1 था - शायद इन "नए" दस्तावेज़ों से परामर्श लें - http://developer.xamarin.com/guides/cross-platform/xamarin- रूपों/उपयोगकर्ता इंटरफ़ेस/tableview / – WickedW