CSE775 DO supporting slides for VRTS Client Demo Vrts Client team: Mohammed koni,Anjan Kumar Bollam Manasavalli Vadali ,Shashikiran Srinivasa 4-13-09 Monday
Notification mechanism INotifyCollectionChanged Notifies listeners of dynamic changes, such as when items get added and removed or the whole list is refreshed INotifyPropertyChanged enable your binding target properties to automatically reflect the dynamic changes of the binding source.
ObservableCollection<T> Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed which is a built-in implementation of a data collection that implements the INotifyCollectionChanged interface.
ObservableCollection<T> C# code behind: public class NameList :ObservableCollection<PersonName> {…} Xaml xmlns:c="clr-namespace:SDKSample“ <Window.Resources> <c:NameList x:Key="NameListData"/> …… </Window.Resources> <ListBox Width="200" ItemsSource="{Binding Source={StaticResource NameListData}}" ItemTemplate="{StaticResource NameItemTemplate}" IsSynchronizedWithCurrentItem="True"/> Ref http://msdn.microsoft.com/en-us/library/ms668604.aspx
WPF threading model Two main threads Rendering thread: hidden and runs in the background. UI thread: for managing the user interface. WPF threading model interoperates well with Win32®-based APIs This means that WPF can host or be hosted by any HWND-based API (Windows Forms, Visual Basic®, MFC, or even Win32). Dispatcher class: The Dispatcher class provides a gateway to the message pump in WPF and provides a mechanism to route work for processing by the UI thread. http://msdn.microsoft.com/en-us/magazine/cc163328.aspx http://msdn.microsoft.com/en-us/library/ms741870.aspx
Include Xaml file into another Xaml file if the resource dictionary is compiled into BAML, we need to use the Application.LoadComponent() method to de-serialize it into ResourceDictionary object, then add it to either Application.Current.Resources or Window.Resources dictionary through the MergedDictionaries property: ResourceDictionary resourceDictionary = Application.LoadComponent(new Uri("CommonResources.xaml", UriKind.Relative)) as ResourceDictionary; if (resourceDictionary != null) { Application.Current.Resources.MergedDictionaries.Add( resourceDictionary); } ref. http://www.vistax64.com/net-general/159438-possible-include-xaml-files-into-another-xaml-file.html