Skip to content

Commit 8cbaf9c

Browse files
JMJM
authored andcommitted
Modified the sample app to adjust to changes recently made in the XamDataPresenter. Specifically, removed the sample functions that manipulated the DynamicDataPendingXxx properties on the XamDataPresenter as these properties have been removed.
Added functionality to the sample to modify a newly added DataPresenterbrushKey called DataPendingOverlayBrushKey which controls the color used to fill the data pending overlay.
1 parent ddd5d4a commit 8cbaf9c

2 files changed

Lines changed: 22 additions & 39 deletions

File tree

DataPresenter.DataSources.OData/DataPresenter.DataSources.OData.SampleApp/MainWindow.xaml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@
143143
<Rectangle Width="1" Height="20" Fill="Transparent"/>
144144
<TextBlock Text="DATAPRESENTER SETTINGS" Style="{StaticResource HeaderText1}"/>
145145

146-
<!-- Pending Message Settings -->
146+
<!-- Data Pending Overlay Settings -->
147147
<Rectangle Width="1" Height="5" Fill="Transparent"/>
148-
<TextBlock Text="DATA PENDING MESSAGE SETTINGS" Style="{StaticResource HeaderText2}"/>
148+
<TextBlock Text="DATA PENDING OVERLAY SETTINGS" Style="{StaticResource HeaderText2}"/>
149149
<Grid>
150150
<Grid.ColumnDefinitions>
151151
<ColumnDefinition Width="3*"/>
@@ -154,22 +154,10 @@
154154

155155
<Grid.RowDefinitions>
156156
<RowDefinition />
157-
<RowDefinition />
158-
<RowDefinition />
159-
<RowDefinition />
160157
</Grid.RowDefinitions>
161158

162-
<TextBlock Grid.Row="0" Grid.Column="0" Text="MESSAGE TEXT" Style="{StaticResource LabelText}"/>
163-
<TextBox x:Name="txtPendingMessage" Grid.Row="0" Grid.Column="1" Text="loading..." TextChanged="txtPendingMessage_TextChanged" Style="{StaticResource TextBoxText}"/>
164-
165-
<TextBlock Grid.Row="1" Grid.Column="0" Text="BACKGROUND" Style="{StaticResource LabelText}"/>
166-
<igControls:XamColorPicker Grid.Row="1" Grid.Column="1" Style="{StaticResource ColorPicker}" SelectedColor="{Binding ElementName=dataPresenter1, Mode=TwoWay, Path=(igDP:XamDataPresenter.FieldLayoutSettings).DynamicDataPendingBackgroundBrush, Converter={StaticResource colorToBrushConverter}}"/>
167-
168-
<TextBlock Grid.Row="2" Grid.Column="0" Text="FOREGROUND" Style="{StaticResource LabelText}"/>
169-
<igControls:XamColorPicker Grid.Row="2" Grid.Column="1" Style="{StaticResource ColorPicker}" SelectedColor="{Binding ElementName=dataPresenter1, Mode=TwoWay, Path=(igDP:XamDataPresenter.FieldLayoutSettings).DynamicDataPendingForegroundBrush, Converter={StaticResource colorToBrushConverter}}"/>
170-
171-
<TextBlock Grid.Row="3" Grid.Column="0" Text="SHOW CUSTOM TEMPLATE" Style="{StaticResource LabelText}"/>
172-
<CheckBox x:Name="chkShowCustomTemplate" Grid.Row="3" Grid.Column="1" Margin="0,2" IsChecked="False" Style="{StaticResource CheckBoxText}" Checked="chkShowCustomTemplate_Checked" Unchecked="chkShowCustomTemplate_Checked"/>
159+
<TextBlock Grid.Row="0" Grid.Column="0" Text="FILL" Style="{StaticResource LabelText}"/>
160+
<igControls:XamColorPicker x:Name="colorPicker" Grid.Row="0" Grid.Column="1" Style="{StaticResource ColorPicker}" SelectedColorChanged="colorPicker_SelectedColorChanged"/>
173161
</Grid>
174162

175163
<!-- Filter Settings -->
@@ -221,9 +209,7 @@
221209

222210
<igDP:XamDataPresenter x:Name="dataPresenter1" Grid.Column="2" Theme="Office2013" Margin="5,0,0,0">
223211
<igDP:XamDataPresenter.FieldLayoutSettings>
224-
<igDP:FieldLayoutSettings DynamicDataPendingBackgroundBrush="#200080FF"
225-
DynamicDataPendingForegroundBrush="DarkGray"
226-
FilterEvaluationMode="UseCollectionView"/>
212+
<igDP:FieldLayoutSettings FilterEvaluationMode="UseCollectionView"/>
227213
</igDP:XamDataPresenter.FieldLayoutSettings>
228214

229215
<igDP:XamDataPresenter.FieldSettings>

DataPresenter.DataSources.OData/DataPresenter.DataSources.OData.SampleApp/MainWindow.xaml.cs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)