【发布时间】:2019-02-04 22:39:47
【问题描述】:
下面的代码有一个类型错误,比如“这个表达式应该有类型'obj',但这里有类型'string'”
let fiveDaysForecast (model: CityForecast) =
let fiveDays = model.Days |> List.truncate 5
let city = if model.Country |> String.IsNullOrWhiteSpace then model.City else sprintf "%s, %s" model.City model.Country
View.StackLayout(padding = 20.0, verticalOptions = LayoutOptions.FillAndExpand,
children = [
View.Label(text=city.ToUpper(), textColor=Color.Beige, backgroundColor=Color.FromHex("#0F4D8FAC"), fontSize=40, fontAttributes=FontAttributes.Bold, horizontalTextAlignment=TextAlignment.Center)
empty 20.
View.Grid(
rowdefs=["*"],
coldefs=[ for _ in fiveDays -> "*" ],
children = (fiveDays |> List.mapi (day 0) ) )
])
由于"*"coldefs=[ for _ in fiveDays -> "*" ], 这行代码出错
我应该如何解决它?
【问题讨论】:
-
是 WPF 还是别的什么?
coldefs的类型是什么? -
Sooo... Xamarin 还是 WPF?另外:
coldefs的类型是什么? -
@FyodorSoikin xamarin,字符串
-
coldefs的值为string?您确定它不是列表或数组或类似的东西吗? -
@FyodorSoikin 很抱歉,它是数组
标签: f#