很久没写win8知识学习了感觉有好多不同win8的定义 1、定义静态变量和静态方法 static property ResourceContext^ mContext ; static String^ GetProperty(String^ name); static property int highLight; 2、弹出MessageDialog Windows::UI::Popups::MessageDialog^ _mes=ref new Windows::UI::Popups::MessageDialog("hello alert"); _mes->showasyn(); 3、集合对象都变成了向量 Windows::Foundation::Collections::IObservableVector<Platform::Object^>^ ItemGroups=ref new Platform::Collections::Vector<Platform::Object^>(); ItemGroups->append("your Item"); 4、绑定 property Platform::String^ Title { Platform::String^ get(){return _Title;} void set(Platform::String^ value){_Title = value;OnPropertyChanged("Title ");}} 必须实现INotifyPropertyChanged接口也可以说是继承这个类 /// <summary> /// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models. /// </summary> [Windows::Foundation::Metadata::WebHostHidden] public ref class BindableBase : Windows::UI::Xaml::Data::INotifyPropertyChanged { public: virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ PropertyChanged; protected: virtual void OnPropertyChanged(Platform::String^ propertyName); };
相关文章: