Created
July 12, 2013 12:50
-
-
Save jogibear9988/5984220 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User jkuehner | |
# Date 1373633404 -7200 | |
# Fri Jul 12 14:50:04 2013 +0200 | |
# Node ID 66606f655bdc1f2a6208c6ae4cf02289cefebc5e | |
# Parent f57b80cbd9298a4e195c080cfb97ffae12951fca | |
Support for Changing ItemsSource | |
diff -r f57b80cbd929 -r 66606f655bdc Source/Examples/ItemsGrid/FeaturesDemo/Examples/ViewModel.cs | |
--- a/Source/Examples/ItemsGrid/FeaturesDemo/Examples/ViewModel.cs Fri Jul 12 14:08:19 2013 +0200 | |
+++ b/Source/Examples/ItemsGrid/FeaturesDemo/Examples/ViewModel.cs Fri Jul 12 14:50:04 2013 +0200 | |
@@ -29,6 +29,7 @@ | |
// -------------------------------------------------------------------------------------------------------------------- | |
using System.Data; | |
+using System.Linq; | |
namespace FeaturesDemo | |
{ | |
@@ -128,7 +129,7 @@ | |
DataTable501.Rows.Add(new object[] {3, 4}); | |
DataTable501.Rows.Add(new object[] { 5, 6 }); | |
DataTable501.Rows.Add(new object[] { 7, 8 }); | |
- DataTable501.Rows.Add(new object[] { 9, 10 }); | |
+ DataTable501.Rows.Add(new object[] { 9, 10 }); | |
} | |
public DataTable DataTable501 { get; set; } | |
diff -r f57b80cbd929 -r 66606f655bdc Source/PropertyTools.Wpf/ItemsGrid/ItemsGrid.Content.cs | |
--- a/Source/PropertyTools.Wpf/ItemsGrid/ItemsGrid.Content.cs Fri Jul 12 14:08:19 2013 +0200 | |
+++ b/Source/PropertyTools.Wpf/ItemsGrid/ItemsGrid.Content.cs Fri Jul 12 14:50:04 2013 +0200 | |
@@ -28,6 +28,7 @@ | |
// </summary> | |
// -------------------------------------------------------------------------------------------------------------------- | |
+using System.Collections; | |
using System.Data; | |
namespace PropertyTools.Wpf | |
@@ -279,9 +280,17 @@ | |
if (this.ItemsSource == null) | |
{ | |
+ this.PropertyDefinitions.Clear(); | |
+ oldItemsSource = null; | |
return; | |
} | |
+ if (oldItemsSource != this.ItemsSource) | |
+ { | |
+ oldItemsSource = this.ItemsSource; | |
+ this.PropertyDefinitions.Clear(); | |
+ } | |
+ | |
if (this.AutoGenerateColumns && this.PropertyDefinitions.Count == 0) | |
{ | |
// Auto-generate the columns | |
diff -r f57b80cbd929 -r 66606f655bdc Source/PropertyTools.Wpf/ItemsGrid/ItemsGrid.cs | |
--- a/Source/PropertyTools.Wpf/ItemsGrid/ItemsGrid.cs Fri Jul 12 14:08:19 2013 +0200 | |
+++ b/Source/PropertyTools.Wpf/ItemsGrid/ItemsGrid.cs Fri Jul 12 14:50:04 2013 +0200 | |
@@ -279,6 +279,11 @@ | |
private Border topleft; | |
/// <summary> | |
+ /// The Previous ItemsSource | |
+ /// </summary> | |
+ private IList oldItemsSource; | |
+ | |
+ /// <summary> | |
/// Initializes static members of the <see cref="ItemsGrid" /> class. | |
/// </summary> | |
static ItemsGrid() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment