我无法让我的长列表选择器正常工作.当列表高于屏幕时,长列表选择器保持静态,我无法滚动查看所有项目.
有什么想法吗?
<phone:PivotItem Header="{Binding Path=LocalizedResources.ApplicationsHeader, Source={StaticResource LocalizedStrings}}" x:Name="applicationsPivotItem">
<Grid x:Name="applications" Grid.Row="1">
<phone:LongListSelector x:Name="MainLongListSelector" ItemsSource="{Binding Items}" SelectionChanged="MainLongListSelector_SelectionChanged">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</Grid>
</phone:PivotItem>
Run Code Online (Sandbox Code Playgroud) 我有以下对象:
var object = {
"property1": "value1",
"property2": "value2",
"subobject": {
"property1": "value1",
"property2": "value2",
"subobject": {
"property1": "value1",
"property2": "value2",
"subobject": {...
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我试图设置一个嵌套的子对象属性,但嵌套级别是动态的.
如何在不执行以下操作的情况下动态设置其中一个嵌套属性:object.subobject.subobject = { ... }?
编辑: 所以更具体一点,我试图设置一个嵌套的子对象,但我不会每次都知道哪一个.
我一直在墙上撞了好几个小时......看了很多页面,我觉得我的脚本是正确的,但是我的收藏品并没有触发add事件加上:true传入获取方法.我可以绑定到重置事件,但add事件不会触发..
模型:
test.Models.AppBlock = Backbone.Model.extend({
defaults: {
AppID: null,
AppName: null,
AppDescription: null
},
idAttribute: "AppID"
});
Run Code Online (Sandbox Code Playgroud)
采集:
test.Collections.AppBlock = Backbone.Collection.extend({
model: test.Models.AppBlock,
url: ApiPath + "apps/byuser",
Loading: false,
initialize: function () {
},
getAppBlocks: function () {
if (!this.Loading) {
this.Loading = true;
this.fetch({
data: JSON.stringify({
Token: test.Session.Token
}),
add: true, // OMG WTF ?!?!
type: 'POST',
dataType: 'json',
contentType: 'application/json',
cache: false,
success: this.getAppBlocksSuccess,
error: this.getAppBlocksError
});
}
},
parse: function (response) {
return response.Data;
},
getAppBlocksSuccess: function …Run Code Online (Sandbox Code Playgroud) 我试图找出一个原因,为什么这个循环是如此缓慢,但我还没有得到一个很好的答案.以下循环需要一分钟才能执行:
string answer = "";
string headers = "";
string datarows = "";
bool firstRun = true;
foreach (Dictionary<string, string> row in JSON)
{
datarows += "<tr>";
foreach (KeyValuePair<String, String> cell in row)
{
if (firstRun) { headers += "<th>" + cell.Key + "</th>"; }
datarows += "<td>" + cell.Value + "</td>";
}
datarows += "</tr>";
firstRun = false;
}
answer += "<table><tr>" + headers + "</tr>" + datarows + "</table>";
return answer;
Run Code Online (Sandbox Code Playgroud)
JSON变量是一个List,包含大约1150个词典.每个字典包含9个键值对.有什么想法吗?