这是在Xamarin的C#中。我正在使用跨平台的UI代码。类似于仅使用.XAML文件,但我在代码中进行操作。
var viewPickerAutoSaveTimer = new StackLayout();
viewPickerAutoSaveTimer.Orientation = StackOrientation.Horizontal;
viewPickerAutoSaveTimer.Padding = 13;
Label labelAutoSaveTimer = new Label()
{
VerticalOptions = LayoutOptions.Center,
Text = "Auto Save Timer"
};
Picker pickerAutoSaveTimer = new Picker()
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.Center,
SelectedIndex = 1,
Items = { "1", "2", "3" }
};
viewPickerAutoSaveTimer.Children.Add(labelAutoSaveTimer);
viewPickerAutoSaveTimer.Children.Add(pickerAutoSaveTimer);
接下来,我有以下代码。
new TableSection ("AUTO SAVE") {
new SwitchCell {
Text = "Enable Auto Save:"
},
new ViewCell
{
View = viewPickerAutoSaveTimer
}
},
这是结果的屏幕截图-
“自动保存计时器”旁边的行应在选择器上显示所选项目...但是不会!
相关分类