Skip to content

Commit

Permalink
Update MainWindow.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDHarper authored Oct 21, 2020
1 parent e0f9650 commit 578be5f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Sample Applications/DataBindingDemo/MainWindow.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// // Copyright (c) Microsoft. All rights reserved.
// // Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Specialized;
using System.ComponentModel;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Data;

namespace DataBindingDemo
Expand Down Expand Up @@ -41,11 +44,21 @@ private void AddGrouping(object sender, RoutedEventArgs args)
// This groups the items in the view by the property "Category"
var groupDescription = new PropertyGroupDescription {PropertyName = "Category"};
_listingDataView.GroupDescriptions.Add(groupDescription);

NotifyUpdate();

}

private void NotifyUpdate()
{
var listingPeer = ListBoxAutomationPeer.FromElement(Master);
listingPeer.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
}

private void RemoveGrouping(object sender, RoutedEventArgs args)
{
_listingDataView.GroupDescriptions.Clear();
NotifyUpdate();
}

private void AddSorting(object sender, RoutedEventArgs args)
Expand All @@ -57,21 +70,26 @@ private void AddSorting(object sender, RoutedEventArgs args)
new SortDescription("Category", ListSortDirection.Ascending));
_listingDataView.SortDescriptions.Add(
new SortDescription("StartDate", ListSortDirection.Ascending));
NotifyUpdate();
}

private void RemoveSorting(object sender, RoutedEventArgs args)
{
_listingDataView.SortDescriptions.Clear();
NotifyUpdate();
}

private void AddFiltering(object sender, RoutedEventArgs args)
{
_listingDataView.Filter += ShowOnlyBargainsFilter;
NotifyUpdate();
}

private void RemoveFiltering(object sender, RoutedEventArgs args)
{
_listingDataView.Filter -= ShowOnlyBargainsFilter;
NotifyUpdate();
}
}
}

}

0 comments on commit 578be5f

Please sign in to comment.