code_junkie

Equivalent WPF binding syntax

Nov 12th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.44 KB | None | 0 0
  1. public class ApplicationPresenter
  2. {
  3. public ObservableCollection<Quotes> PriceList {get;}
  4. }
  5.  
  6.  
  7. public class WebSitePricesView
  8. {
  9. private IApplicationPresenter presenter
  10. {
  11. get { return (ApplicationPresenter)DataContext; }
  12. }
  13.  
  14. // public ObservableCollection<Quotes> PriceList
  15. // {
  16. // get {return presenter.PriceList; }
  17. }
  18. }
  19.  
  20. <UserControl.Resources>
  21. <ObjectDataProvider x:Key="ApplicationPresenterDS" ObjectType="{x:Type local:ApplicationPresenter}" />
  22. <xcdg:DataGridCollectionViewSource x:Key="price_list" Source="{Binding Path=PriceList} />
  23. </UserControl.Resources>
  24. <xcdg:DataGridControl ItemsSource="{Binding Source={StaticResource price_list}} />
  25.  
  26. <UserControl.Resources>
  27. <ObjectDataProvider x:Key="ApplicationPresenterDS" ObjectType="{x:Type local:ApplicationPresenter}" />
  28. <xcdg:DataGridCollectionViewSource x:Key="price_list" Source="{Binding Source={StaticResource ApplicationPresenterDS}, Path=PriceList />
  29. </UserControl.Resources>
  30. <xcdg:DataGridControl ItemsSource="{Binding Source={StaticResource price_list}} />
  31.  
  32. Step into: Stepping over method without symbols 'Fenix.App.App'
  33. System.Windows.Data Warning: 52 : Created BindingExpression (hash=35059110) for Binding (hash=15586314)
  34. System.Windows.Data Warning: 54 : Path: 'PriceList'
  35. System.Windows.Data Warning: 56 : BindingExpression (hash=35059110): Default mode resolved to OneWay
  36. System.Windows.Data Warning: 57 : BindingExpression (hash=35059110): Default update trigger resolved to PropertyChanged
  37. System.Windows.Data Warning: 58 : BindingExpression (hash=35059110): Attach to Xceed.Wpf.DataGrid.DataGridCollectionViewSource.Source (hash=28137373)
  38. System.Windows.Data Warning: 60 : BindingExpression (hash=35059110): Use Framework mentor <null>
  39. System.Windows.Data Warning: 63 : BindingExpression (hash=35059110): Resolving source
  40. System.Windows.Data Warning: 65 : BindingExpression (hash=35059110): Framework mentor not found
  41. System.Windows.Data Warning: 61 : BindingExpression (hash=35059110): Resolve source deferred
  42. System.Windows.Data Warning: 91 : BindingExpression (hash=35059110): Got InheritanceContextChanged event from DataGridCollectionViewSource (hash=28137373)
  43. System.Windows.Data Warning: 63 : BindingExpression (hash=35059110): Resolving source
  44. System.Windows.Data Warning: 66 : BindingExpression (hash=35059110): Found data context element: WebSitePricesXc (hash=11090012) (OK)
  45. System.Windows.Data Warning: 67 : BindingExpression (hash=35059110): DataContext is null
  46. System.Windows.Data Warning: 52 : Created BindingExpression (hash=53154844) for Binding (hash=52037308)
  47. System.Windows.Data Warning: 54 : Path: ''
  48. System.Windows.Data Warning: 56 : BindingExpression (hash=53154844): Default mode resolved to OneWay
  49. System.Windows.Data Warning: 57 : BindingExpression (hash=53154844): Default update trigger resolved to PropertyChanged
  50. System.Windows.Data Warning: 58 : BindingExpression (hash=53154844): Attach to Xceed.Wpf.DataGrid.DataGridControl.ItemsSource (hash=16991442)
  51. System.Windows.Data Warning: 63 : BindingExpression (hash=53154844): Resolving source
  52. System.Windows.Data Warning: 66 : BindingExpression (hash=53154844): Found data context element: <null> (OK)
  53. System.Windows.Data Warning: 72 : BindingExpression (hash=53154844): Use View from DataGridCollectionViewSource (hash=28137373)
  54. System.Windows.Data Warning: 74 : BindingExpression (hash=53154844): Activate with root item <null>
  55. System.Windows.Data Warning: 100 : BindingExpression (hash=53154844): Replace item at level 0 with <null>, using accessor {DependencyProperty.UnsetValue}
  56. System.Windows.Data Warning: 97 : BindingExpression (hash=53154844): GetValue at level 0 from <null> using <null>: <null>
  57. System.Windows.Data Warning: 76 : BindingExpression (hash=53154844): TransferValue - got raw value <null>
  58. System.Windows.Data Warning: 85 : BindingExpression (hash=53154844): TransferValue - using final value <null>
  59. A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
  60. System.Windows.Data Warning: 63 : BindingExpression (hash=35059110): Resolving source
  61. System.Windows.Data Warning: 66 : BindingExpression (hash=35059110): Found data context element: WebSitePricesXc (hash=11090012) (OK)
  62. System.Windows.Data Warning: 74 : BindingExpression (hash=35059110): Activate with root item ApplicationPresenter (hash=22260412)
  63. System.Windows.Data Warning: 104 : BindingExpression (hash=35059110): At level 0 - for ApplicationPresenter.PriceList found accessor RuntimePropertyInfo(PriceList)
  64. System.Windows.Data Warning: 100 : BindingExpression (hash=35059110): Replace item at level 0 with ApplicationPresenter (hash=22260412), using accessor RuntimePropertyInfo(PriceList)
  65. System.Windows.Data Warning: 97 : BindingExpression (hash=35059110): GetValue at level 0 from ApplicationPresenter (hash=22260412) using RuntimePropertyInfo(PriceList): ObservableCollection`1 (hash=40261689 Count=0)
  66. System.Windows.Data Warning: 76 : BindingExpression (hash=35059110): TransferValue - got raw value ObservableCollection`1 (hash=40261689 Count=0)
  67. System.Windows.Data Warning: 85 : BindingExpression (hash=35059110): TransferValue - using final value ObservableCollection`1 (hash=40261689 Count=0)
  68. System.Windows.Data Warning: 92 : BindingExpression (hash=53154844): Got PropertyChanged event from DataGridCollectionViewSource (hash=28137373) for View
  69. System.Windows.Data Warning: 75 : BindingExpression (hash=53154844): Deactivate
  70. System.Windows.Data Warning: 99 : BindingExpression (hash=53154844): Replace item at level 0 with {NullDataItem}
  71. System.Windows.Data Warning: 72 : BindingExpression (hash=53154844): Use View from DataGridCollectionViewSource (hash=28137373)
  72. System.Windows.Data Warning: 74 : BindingExpression (hash=53154844): Activate with root item DataGridCollectionView (hash=22444475 Count=0)
  73. System.Windows.Data Warning: 100 : BindingExpression (hash=53154844): Replace item at level 0 with DataGridCollectionView (hash=22444475 Count=0), using accessor {DependencyProperty.UnsetValue}
  74. System.Windows.Data Warning: 97 : BindingExpression (hash=53154844): GetValue at level 0 from DataGridCollectionView (hash=22444475 Count=0) using <null>: DataGridCollectionView (hash=22444475 Count=0)
  75. System.Windows.Data Warning: 76 : BindingExpression (hash=53154844): TransferValue - got raw value DataGridCollectionView (hash=22444475 Count=0)
  76. System.Windows.Data Warning: 85 : BindingExpression (hash=53154844): TransferValue - using final value DataGridCollectionView (hash=22444475 Count=0)
  77. System.Windows.Data Warning: 91 : BindingExpression (hash=35059110): Got PropertyChanged event from ApplicationPresenter (hash=22260412)
  78. System.Windows.Data Warning: 97 : BindingExpression (hash=35059110): GetValue at level 0 from ApplicationPresenter (hash=22260412) using RuntimePropertyInfo(PriceList): ObservableCollection`1 (hash=6408547 Count=27)
  79. System.Windows.Data Warning: 76 : BindingExpression (hash=35059110): TransferValue - got raw value ObservableCollection`1 (hash=6408547 Count=27)
  80. System.Windows.Data Warning: 85 : BindingExpression (hash=35059110): TransferValue - using final value ObservableCollection`1 (hash=6408547 Count=27)
  81. System.Windows.Data Warning: 92 : BindingExpression (hash=53154844): Got PropertyChanged event from DataGridCollectionViewSource (hash=28137373) for View
  82. System.Windows.Data Warning: 75 : BindingExpression (hash=53154844): Deactivate
  83. System.Windows.Data Warning: 99 : BindingExpression (hash=53154844): Replace item at level 0 with {NullDataItem}
  84. System.Windows.Data Warning: 72 : BindingExpression (hash=53154844): Use View from DataGridCollectionViewSource (hash=28137373)
  85. System.Windows.Data Warning: 74 : BindingExpression (hash=53154844): Activate with root item DataGridCollectionView (hash=61423861 Count=27)
  86. System.Windows.Data Warning: 100 : BindingExpression (hash=53154844): Replace item at level 0 with DataGridCollectionView (hash=61423861 Count=27), using accessor {DependencyProperty.UnsetValue}
  87. System.Windows.Data Warning: 97 : BindingExpression (hash=53154844): GetValue at level 0 from DataGridCollectionView (hash=61423861 Count=27) using <null>: DataGridCollectionView (hash=61423861 Count=27)
  88. System.Windows.Data Warning: 76 : BindingExpression (hash=53154844): TransferValue - got raw value DataGridCollectionView (hash=61423861 Count=27)
  89. System.Windows.Data Warning: 85 : BindingExpression (hash=53154844): TransferValue - using final value DataGridCollectionView (hash=61423861 Count=27)
  90.  
  91. Step into: Stepping over method without symbols 'Fenix.App.App'
  92. System.Windows.Data Warning: 52 : Created BindingExpression (hash=35059110) for Binding (hash=15586314)
  93. System.Windows.Data Warning: 54 : Path: 'PriceList'
  94. System.Windows.Data Warning: 56 : BindingExpression (hash=35059110): Default mode resolved to OneWay
  95. System.Windows.Data Warning: 57 : BindingExpression (hash=35059110): Default update trigger resolved to PropertyChanged
  96. System.Windows.Data Warning: 58 : BindingExpression (hash=35059110): Attach to Xceed.Wpf.DataGrid.DataGridCollectionViewSource.Source (hash=28137373)
  97. System.Windows.Data Warning: 63 : BindingExpression (hash=35059110): Resolving source
  98. System.Windows.Data Warning: 66 : BindingExpression (hash=35059110): Found data context element: <null> (OK)
  99. System.Windows.Data Warning: 73 : BindingExpression (hash=35059110): Use Data from ObjectDataProvider (hash=61302538)
  100. System.Windows.Data Warning: 74 : BindingExpression (hash=35059110): Activate with root item ApplicationPresenter (hash=20390146)
  101. System.Windows.Data Warning: 104 : BindingExpression (hash=35059110): At level 0 - for ApplicationPresenter.PriceList found accessor RuntimePropertyInfo(PriceList)
  102. System.Windows.Data Warning: 100 : BindingExpression (hash=35059110): Replace item at level 0 with ApplicationPresenter (hash=20390146), using accessor RuntimePropertyInfo(PriceList)
  103. System.Windows.Data Warning: 97 : BindingExpression (hash=35059110): GetValue at level 0 from ApplicationPresenter (hash=20390146) using RuntimePropertyInfo(PriceList): ObservableCollection`1 (hash=12781633 Count=0)
  104. System.Windows.Data Warning: 76 : BindingExpression (hash=35059110): TransferValue - got raw value ObservableCollection`1 (hash=12781633 Count=0)
  105. System.Windows.Data Warning: 85 : BindingExpression (hash=35059110): TransferValue - using final value ObservableCollection`1 (hash=12781633 Count=0)
  106. System.Windows.Data Warning: 52 : Created BindingExpression (hash=12661120) for Binding (hash=31408037)
  107. System.Windows.Data Warning: 54 : Path: ''
  108. System.Windows.Data Warning: 56 : BindingExpression (hash=12661120): Default mode resolved to OneWay
  109. System.Windows.Data Warning: 57 : BindingExpression (hash=12661120): Default update trigger resolved to PropertyChanged
  110. System.Windows.Data Warning: 58 : BindingExpression (hash=12661120): Attach to Xceed.Wpf.DataGrid.DataGridControl.ItemsSource (hash=16991442)
  111. System.Windows.Data Warning: 63 : BindingExpression (hash=12661120): Resolving source
  112. System.Windows.Data Warning: 66 : BindingExpression (hash=12661120): Found data context element: <null> (OK)
  113. System.Windows.Data Warning: 72 : BindingExpression (hash=12661120): Use View from DataGridCollectionViewSource (hash=28137373)
  114. System.Windows.Data Warning: 74 : BindingExpression (hash=12661120): Activate with root item DataGridCollectionView (hash=49343907 Count=0)
  115. System.Windows.Data Warning: 100 : BindingExpression (hash=12661120): Replace item at level 0 with DataGridCollectionView (hash=49343907 Count=0), using accessor {DependencyProperty.UnsetValue}
  116. System.Windows.Data Warning: 97 : BindingExpression (hash=12661120): GetValue at level 0 from DataGridCollectionView (hash=49343907 Count=0) using <null>: Data``GridCollectionView (hash=49343907 Count=0)
  117. System.Windows.Data Warning: 76 : BindingExpression (hash=12661120): TransferValue - got raw value DataGridCollectionView (hash=49343907 Count=0)
  118. System.Windows.Data Warning: 85 : BindingExpression (hash=12661120): TransferValue - using final value DataGridCollectionView (hash=49343907 Count=0)
  119. A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
  120.  
  121. public class Quotes
  122. {
  123. public string Description { get; set; }
  124. public decimal Value { get; set; }
  125. }
  126.  
  127. public class ApplicationPresenter
  128. {
  129. public ApplicationPresenter()
  130. {
  131. PriceList = new ObservableCollection<Quotes>()
  132. {
  133. new Quotes(){Description="Quote One", Value=10m},
  134. new Quotes(){Description="Quote Two", Value=10m},
  135. new Quotes(){Description="Quote Three", Value=10m},
  136. new Quotes(){Description="Quote Four", Value=10m},
  137. };
  138. }
  139. public ObservableCollection<Quotes> PriceList { get; private set; }
  140. }
  141.  
  142. <Window
  143. x:Class="ObjectDataProviderPresenterSample.Window1"
  144. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  145. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  146. xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
  147. xmlns:local="clr-namespace:ObjectDataProviderPresenterSample"
  148. Title="Window1"
  149. Height="300"
  150. Width="300"
  151. >
  152. <Window.Resources>
  153. <ObjectDataProvider
  154. x:Key="ApplicationPresenterDS"
  155. ObjectType="{x:Type local:ApplicationPresenter}"
  156. />
  157. <xcdg:DataGridCollectionViewSource
  158. x:Key="price_list"
  159. Source="{Binding
  160. Source={StaticResource ApplicationPresenterDS},
  161. Path=PriceList}"
  162. />
  163. </Window.Resources>
  164.  
  165. <Grid>
  166. <xcdg:DataGridControl ItemsSource="{Binding Source={StaticResource price_list}}" />
  167. </Grid>
  168. </Window>
Add Comment
Please, Sign In to add comment