【发布时间】:2016-08-16 21:52:41
【问题描述】:
我是 xamarin 的新手。我正在尝试在 xamarin 表单中创建手风琴控件。我也创建了。在开始时我只放置了按钮和标签
用于演示目的。这是我从后面的代码绑定的。像这样
var vViewLayout1 = new StackLayout()
{
Children = {
new Label { Text = "Regular Board Meeting",HorizontalOptions=LayoutOptions.Center },
new StackLayout
{
Spacing = 5,
Orientation = StackOrientation.Horizontal,
VerticalOptions= LayoutOptions.Center,
HorizontalOptions= LayoutOptions.End,
Children =
{
new Image { Source = "Chat.png"},
new Button { Text ="Reject",BackgroundColor = Color.Red,TextColor = Color.White},
new Button { Text ="Approve",BackgroundColor = Color.Green,TextColor = Color.White}
}
},
//new Label { Text = "Name : S Ravi Kumar" },
//new Label { Text = "Roles : Father,Trainer,Consultant,Architect" }
}
};
var vFirstAccord = new AccordionSource()
{
HeaderText = "ReportToBoardJune 1,2016",
HeaderTextColor = Color.White,
HeaderBackGroundColor = Color.Red,
ContentItems = vViewLayout1
};
return vResult;
那么,我怎样才能从后面的代码中创建它。以及我应该为我用红色箭头突出显示的框使用哪个控件。boxview 或 xamarine 中的任何其他可用的表格或其他任何东西。
我刚开始使用 xamarin。所以我对它的控件一无所知。任何建议或帮助都非常重要。提前致谢。
【问题讨论】:
-
我认为Grid 将满足您对突出显示的框的需求。您可以使用大小均匀的单元格配置 3x3 网格,并在需要的位置添加标签。该 API 文档包含一个从后面的代码中使用 Grid 的示例。
-
是的..我用过。 grid.but 如何从后面的代码中创建边框?
-
我找不到网格的边框属性
-
Xamarin.Forms 在每个视图中往往具有非常有限的属性。您可以自己添加属性,使用自定义渲染器或自定义控件,也可以将
Grid放在ContentView中并设置BackgroundColor和Padding属性以获得所需的结果。 -
@Dylan:非常感谢您的建议和帮助...
标签: xamarin code-behind