2015-02-23 90 views
1

我的新手,當談到xamarin,也是在XAML,我只是想問問如何添加填充我viewcell裏面下面是我的代碼添加填充內ViewCell xamarin

<TableView> 
     <TableRoot> 
      <TableSection Title = "Basic information"> 
       <EntryCell Label = "First name: " Placeholder = "Required" /> 
       <EntryCell Label = "Middel name: " Placeholder = "Optional" /> 
       <EntryCell Label = "Last name: " Placeholder = "Required" /> 
       <ViewCell> 
        <Picker x:Name="genderPicker" Title = "Select gender"></Picker> 
       </ViewCell> 
      </TableSection> 
     </TableRoot> 
</TableView> 

我要的是在此代碼中添加一點點填充。

  ![<ViewCell> 
       <Picker x:Name="genderPicker" Title = "Select gender"></Picker> 
      </ViewCell>][1] 

這就是它的樣子,所以我只是想在我的選取器視圖中添加一些左右空間。

http://i.stack.imgur.com/89qt9.png

回答

2

像這樣的東西應該工作正常:

<Picker x:Name="genderPicker" 
    Title = "Select gender" 
    Padding="left, top, right, bottom"> 
    </Picker> 

有左,上,右,下,你希望值。更多信息here

0

在ViewCell中添加一個支持填充的StackLayout或任何其他佈局子類型。然後,您可以使用佈局屬性來調整拾取器。

<ViewCell> 
    <StackLayout Padding="10,0,0,0" HorizontalOptions="FillAndExpand"> 
    <Picker HorizontalOptions="CenterAndExpand" > 
     <Picker.Items> 
     <x:String>Disabled</x:String> 
     <x:String>5 minutes</x:String> 
     </Picker.Items> 
     <Picker.SelectedIndex>0</Picker.SelectedIndex> 
    </Picker> 
    </StackLayout> 
</ViewCell> 

與CSS或Android瀏覽,您可以在Xamarin.Forms工作時調整控件本身,你會處理大部分使用父佈局的填充。