我可以在WinRT/Windows8商店应用中绑定DynamicObject我有以下代码:publicclassMyClass:DynamicObject,INotifyPropertyChanged{Dictionaryproperties=新字典();publicoverrideboolTryGetMember(GetMemberBinderbinder,outobjectresult){if(properties.ContainsKey(binder.Name)){result=properties[binder.Name];}返回真;}else{result="无效的属性!";返回假;}}publicoverrideboolTrySetMember(SetMemberBinderbinder,objectvalue){properties[binder.Name]=value;this.OnPropertyChanged(binder.Name);返回真;}publicoverrideboolTryInvokeMember(InvokeMemberBinderbinder,object[]args,outobjectresult){dynamicmethod=properties[binder.Name];结果=方法(args[0].ToString(),args[1].ToString());返回真;}///....班级的其余部分。当我从xaml绑定它时,TryGetMember中的调试点不是triggeret。我错过了什么吗?datacontext设置为publicObservableCollectionSearchResults{get;set;}和ICollectioncol=item.SearchResults;this.DefaultViewModel["Results"]=col;//这是gridview的datacontext这是我的动态绑定计划的解决方案。绑定语法只需要包含[]:以上是C#学习教程:我可以在WinRT/Windows8商店应用程序中绑定所有DynamicObject共享的内容。如果对大家有用,需要进一步了解C#学习教程,希望大家多多关注——.ContainsKey(名称))返回ApplicationData.Current.LocalSettings.Values[名称];返回空值;}set{ApplicationData.Current.LocalSettings.Values[名称]=值;OnPropertyChanged(名称);}}}本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
