@@ -43,6 +43,14 @@ public MainWindow()
4343 this . cboOdataSources . SelectedIndex = 0 ;
4444 this . cboDataPresenterView . SelectedIndex = 0 ;
4545 this . cboRecordFilterLogicalOperator . SelectedIndex = 0 ;
46+
47+ // Initialize the color picker with the current DataPendingOverlayBrush.
48+ if ( this . dataPresenter1 . Resources . Contains ( DataPresenterBrushKeys . DataPendingOverlayBrushKey ) )
49+ {
50+ SolidColorBrush overlayBrush = this . dataPresenter1 . Resources [ DataPresenterBrushKeys . DataPendingOverlayBrushKey ] as SolidColorBrush ;
51+ if ( null != overlayBrush )
52+ this . colorPicker . SelectedColor = overlayBrush . Color ;
53+ }
4654 }
4755 #endregion //Constructor
4856
@@ -236,23 +244,20 @@ private void cboRecordFilterLogicalOperator_SelectionChanged(object sender, Sele
236244 }
237245 #endregion //cboRecordFilterLogicalOperator_SelectionChanged
238246
239- #region chkShowCustomTemplate_Checked
240- private void chkShowCustomTemplate_Checked ( object sender , RoutedEventArgs e )
247+ #region colorPicker_SelectedColorChanged
248+ private void colorPicker_SelectedColorChanged ( object sender , Infragistics . Controls . Editors . SelectedColorChangedEventArgs e )
241249 {
242- if ( this . chkShowCustomTemplate . IsChecked . Value )
250+ if ( e . NewColor . HasValue )
243251 {
244- FrameworkElementFactory fef = new FrameworkElementFactory ( typeof ( ProgressBar ) ) ;
245- fef . SetValue ( ProgressBar . IsIndeterminateProperty , true ) ;
246- fef . SetValue ( ProgressBar . WidthProperty , 100d ) ;
247- fef . SetValue ( ProgressBar . HeightProperty , 5d ) ;
252+ // Remove the existing DataPendingOverlayBrush resource from the XamDataPresenter Resources dictionary.
253+ if ( this . dataPresenter1 . Resources . Contains ( DataPresenterBrushKeys . DataPendingOverlayBrushKey ) )
254+ this . dataPresenter1 . Resources . Remove ( DataPresenterBrushKeys . DataPendingOverlayBrushKey ) ;
248255
249- DataTemplate customTemplate = new DataTemplate { VisualTree = fef } ;
250- this . dataPresenter1 . FieldLayoutSettings . DynamicDataPendingContentTemplate = customTemplate ;
256+ // Add a new DataPendingOverlayBrush resource for the selected color to the XamDataPresenter Resources dictionary.
257+ this . dataPresenter1 . Resources . Add ( DataPresenterBrushKeys . DataPendingOverlayBrushKey , new SolidColorBrush ( e . NewColor . Value ) ) ;
251258 }
252- else
253- this . dataPresenter1 . FieldLayoutSettings . DynamicDataPendingContentTemplate = null ;
254259 }
255- #endregion //chkShowCustomTemplate_Checked
260+ #endregion //colorPicker_SelectedColorChanged
256261
257262 #region numDesiredPageSize_EditModeEnded
258263 private void numDesiredPageSize_EditModeEnded ( object sender , Infragistics . Windows . Editors . Events . EditModeEndedEventArgs e )
@@ -270,14 +275,6 @@ private void numMaximumCachedPages_EditModeEnded(object sender, Infragistics.Win
270275 }
271276 #endregion //numMaximumCachedPages_EditModeEnded
272277
273- #region txtPendingMessage_TextChanged
274- private void txtPendingMessage_TextChanged ( object sender , TextChangedEventArgs e )
275- {
276- // Update the dynamic resource string for the 'dynamic data pending' message.
277- Infragistics . Windows . DataPresenter . Resources . Customizer . SetCustomizedString ( "DynamicDataPendingMessage" , ( ( TextBox ) sender ) . Text ) ;
278- }
279- #endregion //txtPendingMessage_TextChanged
280-
281278 #endregion //Event Handlers
282279 }
283280
0 commit comments