├── ..svnbridge └── .svnbridge ├── .gitignore ├── BuildProcessTemplates ├── DefaultTemplate.11.1.xaml ├── DefaultTemplate.xaml ├── LabDefaultTemplate.11.xaml └── UpgradeTemplate.xaml ├── Home_Screenshot-live.png ├── Readme.md ├── SharePointLogViewer.sln └── SharePointLogViewer ├── ..svnbridge └── .svnbridge ├── App.xaml ├── App.xaml.cs ├── Controls ├── AutoCompleteTextBox │ ├── AutoCompleteManager.cs │ ├── AutoCompleteTextBox.cs │ ├── IAutoCompleteDataProvider.cs │ ├── License.txt │ └── SimpleStaticDataProvider.cs ├── BaseWPFHelpers.cs ├── FilterableListView.cs ├── FiterListViewDictionary.xaml ├── LoadingAnimation.xaml ├── LoadingAnimation.xaml.cs ├── SortableGridViewColumn.cs ├── SortableGridViewColumnHeader.cs └── SortableListView.cs ├── Extensions.cs ├── Filters ├── IFilter.cs ├── ListViewFilter.cs └── SeverityFilter.cs ├── HiglightBookmarkedValueConverter.cs ├── Images ├── ..svnbridge │ ├── SPLV.ico │ ├── about.png │ ├── bookmark.png │ ├── clearall.png │ ├── empty.png │ ├── export.png │ ├── next.png │ ├── openfile.png │ ├── play.png │ ├── previous.png │ ├── refresh.png │ ├── search.png │ ├── settings.png │ └── stop.png ├── SPLV.ico ├── about.png ├── bookmark.png ├── clearall.png ├── empty.png ├── export.png ├── next.png ├── openfile.png ├── play.png ├── previous.png ├── refresh.png ├── search.png ├── settings.png └── stop.png ├── LogEntryViewModel.cs ├── LogFilterListView.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Monitoring ├── FileTail.cs ├── ILogMonitor.cs ├── LogDirectoryWatcher.cs ├── LogEntry.cs ├── LogExporter.cs ├── LogMonitor.cs ├── LogParser.cs ├── LogsLoader.cs └── MultiLogMonitor.cs ├── Notifiers ├── EmailNotifier.cs ├── EventLogNotifier.cs ├── INotifier.cs └── SystemTrayNotifier.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── Resources ├── ..svnbridge │ └── WssKey.reg ├── AutoCompleteTextBox.xaml ├── Brushes.xaml ├── FilterableListView.xaml ├── GlassButton.xaml ├── Miscellaneous.xaml └── WssKey.reg ├── SPUtility.cs ├── SPVersion.cs ├── Searching ├── BookmarkNavigator.cs ├── DynamicFilter.cs ├── FastInvoke.cs ├── LogEntryTokenizer.cs └── OverflowCollection.cs ├── SettingBinding.cs ├── SettingsViewModel.cs ├── SettingsWindow.xaml ├── SettingsWindow.xaml.cs ├── SharePointLogViewer.csproj ├── SharePointLogViewer.csproj.user ├── ValueConverter.cs └── app.config /..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignore*.suo 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | bin 3 | obj -------------------------------------------------------------------------------- /BuildProcessTemplates/UpgradeTemplate.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | [New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly }] 21 | 22 | 23 | 24 | [Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto] 25 | [False] 26 | [False] 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | [Microsoft.TeamFoundation.VersionControl.Client.RecursionType.OneLevel] 37 | [Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal] 38 | 39 | 40 | 41 | All 42 | Assembly references and imported namespaces serialized as XML namespaces 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /Home_Screenshot-live.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hasankhan/SharePointLogViewer/3959586bbd8b4f061ab19870b41b47fa07b4cd7f/Home_Screenshot-live.png -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | Welcome to the home of SharePoint Log Viewer. The most advanced and easy to use viewer of MOSS/WSS ULS logs. 2 | 3 | ![ SharePoint Log Viewer](Home_Screenshot-live.png) 4 | 5 | SharePoing Log Viewer is a Windows application for reading and filtering Microsoft SharePoint ULS Logs. 6 | 7 | **Key Features:** 8 | 9 | * View multiple SharePoint log files at once 10 | * Search by any field 11 | * Filter the log by any field 12 | * File drag & drop support 13 | * Live monitoring for +entire farm+ 14 | * Export filtered log entries 15 | * Bookmark log entries 16 | * Get popup notification of SharePoint log events from system tray 17 | * Receive email notifications on errors 18 | * Redirect log entries to event log 19 | * Supports SharePoint 2007, 2010 and 2013 20 | 21 | **System Requirements:** 22 | 23 | * .NET Framework 3.5 24 | * Windows XP or above 25 | 26 | Developed by Overroot Inc. ([http://www.overroot.com](http://www.overroot.com)) -------------------------------------------------------------------------------- /SharePointLogViewer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2008 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharePointLogViewer", "SharePointLogViewer\SharePointLogViewer.csproj", "{95DAD1C0-533D-4B0E-8CC6-A8CA09E1DE4B}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {95DAD1C0-533D-4B0E-8CC6-A8CA09E1DE4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {95DAD1C0-533D-4B0E-8CC6-A8CA09E1DE4B}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {95DAD1C0-533D-4B0E-8CC6-A8CA09E1DE4B}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {95DAD1C0-533D-4B0E-8CC6-A8CA09E1DE4B}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /SharePointLogViewer/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignorebin 2 | svn:ignorebin 3 | obj 4 | -------------------------------------------------------------------------------- /SharePointLogViewer/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /SharePointLogViewer/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Windows; 6 | 7 | namespace SharePointLogViewer 8 | { 9 | /// 10 | /// Interaction logic for App.xaml 11 | /// 12 | public partial class App : Application 13 | { 14 | public static bool RunInBackground { get; set; } 15 | 16 | public static string FileToOpen { get; set; } 17 | 18 | private void Application_Exit(object sender, ExitEventArgs e) 19 | { 20 | SharePointLogViewer.Properties.Settings.Default.Save(); 21 | } 22 | 23 | private void Application_Startup(object sender, StartupEventArgs e) 24 | { 25 | if (e.Args.Length > 0) 26 | if (e.Args[0].Trim() == "/background") 27 | RunInBackground = true; 28 | else 29 | FileToOpen = e.Args[0]; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SharePointLogViewer/Controls/AutoCompleteTextBox/AutoCompleteTextBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Controls; 6 | 7 | namespace SharePointLogViewer.Controls.AutoCompleteTextBox 8 | { 9 | public class AutoCompleteTextBox : TextBox 10 | { 11 | private AutoCompleteManager _acm; 12 | 13 | public AutoCompleteManager AutoCompleteManager 14 | { 15 | get { return _acm; } 16 | } 17 | 18 | public AutoCompleteTextBox() 19 | { 20 | _acm = new AutoCompleteManager(); 21 | _acm.DataProvider = new SimpleStaticDataProvider(Enumerable.Empty()); 22 | this.Loaded += AutoCompleteTextBox_Loaded; 23 | } 24 | 25 | void AutoCompleteTextBox_Loaded(object sender, System.Windows.RoutedEventArgs e) 26 | { 27 | if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) 28 | _acm.AttachTextBox(this); 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SharePointLogViewer/Controls/AutoCompleteTextBox/IAutoCompleteDataProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SharePointLogViewer.Controls.AutoCompleteTextBox 4 | { 5 | public interface IAutoCompleteDataProvider 6 | { 7 | IEnumerable GetItems(string textPattern); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SharePointLogViewer/Controls/AutoCompleteTextBox/License.txt: -------------------------------------------------------------------------------- 1 | Microsoft Public License (Ms-PL) 2 | 3 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 4 | 5 | 1. Definitions 6 | 7 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. 8 | 9 | A "contribution" is the original software, or any additions or changes to the software. 10 | 11 | A "contributor" is any person that distributes its contribution under this license. 12 | 13 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. 14 | 15 | 2. Grant of Rights 16 | 17 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. 18 | 19 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 20 | 21 | 3. Conditions and Limitations 22 | 23 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. 24 | 25 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. 26 | 27 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. 28 | 29 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. 30 | 31 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. -------------------------------------------------------------------------------- /SharePointLogViewer/Controls/AutoCompleteTextBox/SimpleStaticDataProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SharePointLogViewer.Controls.AutoCompleteTextBox 5 | { 6 | public class SimpleStaticDataProvider : IAutoCompleteDataProvider 7 | { 8 | private IEnumerable _source; 9 | 10 | public SimpleStaticDataProvider(IEnumerable source) 11 | { 12 | _source = source; 13 | } 14 | 15 | public IEnumerable GetItems(string textPattern) 16 | { 17 | foreach (var item in _source) 18 | if (item.StartsWith(textPattern, StringComparison.OrdinalIgnoreCase)) 19 | yield return item; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SharePointLogViewer/Controls/FilterableListView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows.Controls; 5 | using System.Windows.Controls.Primitives; 6 | using System.Windows; 7 | using System.Collections; 8 | using System.ComponentModel; 9 | using System.Windows.Data; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Linq; 13 | 14 | 15 | namespace SharePointLogViewer.Controls 16 | { 17 | /// 18 | /// Extends ListView to provide filterable columns 19 | /// 20 | public abstract class FilterableListView : SortableListView 21 | { 22 | protected abstract Type ListItemType { get; } 23 | 24 | #region dependency properties 25 | 26 | /// 27 | /// The style applied to the filter button when it is an active state 28 | /// 29 | public Style FilterButtonActiveStyle 30 | { 31 | get { return (Style)GetValue(FilterButtonActiveStyleProperty); } 32 | set { SetValue(FilterButtonActiveStyleProperty, value); } 33 | } 34 | 35 | public static readonly DependencyProperty FilterButtonActiveStyleProperty = 36 | DependencyProperty.Register("FilterButtonActiveStyle", typeof(Style), typeof(FilterableListView), new UIPropertyMetadata(null)); 37 | 38 | /// 39 | /// The style applied to the filter button when it is an inactive state 40 | /// 41 | public Style FilterButtonInactiveStyle 42 | { 43 | get { return (Style)GetValue(FilterButtonInactiveStyleProperty); } 44 | set { SetValue(FilterButtonInactiveStyleProperty, value); } 45 | } 46 | 47 | public static readonly DependencyProperty FilterButtonInactiveStyleProperty = 48 | DependencyProperty.Register("FilterButtonInActiveStyle", typeof(Style), typeof(FilterableListView), new UIPropertyMetadata(null)); 49 | 50 | #endregion 51 | 52 | public static readonly ICommand ShowFilter = new RoutedCommand(); 53 | 54 | #region inner classes 55 | 56 | /// 57 | /// A simple data holder for passing information regarding filter clicks 58 | /// 59 | class FilterStruct 60 | { 61 | public Button Button {get; private set; } 62 | FilterItem value; 63 | public PropertyDescriptor PropertyDescriptor { get; set; } 64 | 65 | public FilterStruct(PropertyDescriptor propertyDescriptor, Button button, FilterItem value) 66 | { 67 | this.value = value; 68 | this.Button = button; 69 | PropertyDescriptor = propertyDescriptor; 70 | } 71 | 72 | public bool IsMatch(object item) 73 | { 74 | object itemValue = PropertyDescriptor.GetValue(item); 75 | if (itemValue == null) 76 | return value.Item == null; 77 | else 78 | return itemValue.Equals(value.ItemView); 79 | } 80 | } 81 | 82 | /// 83 | /// The items which are bound to the drop down filter list 84 | /// 85 | class FilterItem : IComparable 86 | { 87 | /// 88 | /// The filter item instance 89 | /// 90 | private string item; 91 | 92 | public string Item 93 | { 94 | get { return item; } 95 | set { item = value; } 96 | } 97 | 98 | /// 99 | /// The item viewed in the filter drop down list. Typically this is the same as the item 100 | /// property, however if item is null, this has the value of "[empty]" 101 | /// 102 | private Object itemView; 103 | 104 | public Object ItemView 105 | { 106 | get { return itemView; } 107 | set { itemView = value; } 108 | } 109 | 110 | public FilterItem(IComparable item) 111 | { 112 | if (item == null) 113 | { 114 | itemView = "[empty]"; 115 | this.item = null; 116 | } 117 | else 118 | { 119 | itemView = item; 120 | this.item = item.ToString(); 121 | } 122 | 123 | } 124 | 125 | public override int GetHashCode() 126 | { 127 | return item != null ? item.GetHashCode() : 0; 128 | } 129 | 130 | public override bool Equals(object obj) 131 | { 132 | if (obj == null) 133 | return false; 134 | 135 | FilterItem otherItem = obj as FilterItem; 136 | if (otherItem != null) 137 | return this.item == otherItem.item; 138 | 139 | return base.Equals(obj); 140 | } 141 | 142 | public int CompareTo(object obj) 143 | { 144 | FilterItem otherFilterItem = (FilterItem)obj; 145 | 146 | if (this.Item == null && obj == null) 147 | return 0; 148 | else if (otherFilterItem.Item != null && this.Item != null) 149 | return ((IComparable)item).CompareTo((IComparable)otherFilterItem.item); 150 | else 151 | return -1; 152 | } 153 | } 154 | 155 | #endregion 156 | 157 | Predicate extraFilter; 158 | public Predicate ExtraFilter 159 | { 160 | get { return extraFilter; } 161 | set 162 | { 163 | extraFilter = value; 164 | ApplyCurrentFilters(); 165 | } 166 | } 167 | 168 | Dictionary currentFilters = new Dictionary(); 169 | 170 | private void AddFilter(String property, FilterItem value, Button button) 171 | { 172 | var descriptor = TypeDescriptor.GetProperties(ListItemType)[property]; 173 | var filter = new FilterStruct(descriptor, button, value); 174 | currentFilters[property] = filter; 175 | } 176 | 177 | protected bool IsPropertyFiltered(String property) 178 | { 179 | return currentFilters.ContainsKey(property); 180 | } 181 | 182 | public FilterableListView() 183 | { 184 | CommandBindings.Add(new CommandBinding(ShowFilter, ShowFilterCommand)); 185 | } 186 | 187 | protected override void OnInitialized(EventArgs e) 188 | { 189 | base.OnInitialized(e); 190 | 191 | Uri uri = new Uri("/Controls/FiterListViewDictionary.xaml", UriKind.Relative); 192 | dictionary = Application.LoadComponent(uri) as ResourceDictionary; 193 | 194 | // cast the ListView's View to a GridView 195 | GridView gridView = this.View as GridView; 196 | if (gridView != null) 197 | { 198 | // apply the data template, that includes the popup, button etc ... to each column 199 | foreach (GridViewColumn gridViewColumn in gridView.Columns) 200 | { 201 | SortableGridViewColumn sc = gridViewColumn as SortableGridViewColumn; 202 | if (sc != null && sc.CanBeFiltered) 203 | gridViewColumn.HeaderTemplate = (DataTemplate)dictionary["FilterGridHeaderTemplate"]; 204 | else 205 | gridViewColumn.HeaderTemplate = (DataTemplate)dictionary["SortableGridHeaderTemplate"]; 206 | } 207 | } 208 | 209 | } 210 | 211 | public override void OnApplyTemplate() 212 | { 213 | base.OnApplyTemplate(); 214 | 215 | // ensure that the custom inactive style is applied 216 | if (FilterButtonInactiveStyle != null) 217 | { 218 | List columnHeaders = Helpers.FindElementsOfType(this, typeof(GridViewColumnHeader)); 219 | 220 | foreach (FrameworkElement columnHeader in columnHeaders) 221 | { 222 | Button button = (Button)Helpers.FindElementOfType(columnHeader, typeof(Button)); 223 | if (button != null) 224 | { 225 | button.Style = FilterButtonInactiveStyle; 226 | } 227 | } 228 | } 229 | 230 | } 231 | 232 | /// 233 | /// Handles the ShowFilter command to populate the filter list and display the popup 234 | /// 235 | /// 236 | /// 237 | private void ShowFilterCommand(object sender, ExecutedRoutedEventArgs e) 238 | { 239 | Button button = e.OriginalSource as Button; 240 | 241 | if (button != null) 242 | { 243 | // navigate up to the header 244 | GridViewColumnHeader header = (GridViewColumnHeader)Helpers.FindElementOfTypeUp(button, typeof(GridViewColumnHeader)); 245 | 246 | // then down to the popup 247 | Popup popup = (Popup)Helpers.FindElementOfType(header, typeof(Popup)); 248 | 249 | if (popup != null) 250 | { 251 | SortableGridViewColumn column = (SortableGridViewColumn)header.Column; 252 | String propertyName = column.SortPropertyName; 253 | 254 | var filterList = new List(); 255 | 256 | var uniqueValues = new HashSet(); 257 | 258 | if (IsPropertyFiltered(propertyName)) 259 | filterList.Add(new FilterItem("[clear]")); 260 | else 261 | { 262 | bool containsNull = false; 263 | PropertyDescriptor filterPropDesc = TypeDescriptor.GetProperties(ListItemType)[propertyName]; 264 | 265 | foreach (Object item in Items) 266 | { 267 | object value = filterPropDesc.GetValue(item); 268 | if (value != null) 269 | { 270 | if (uniqueValues.Add(value)) 271 | filterList.Add(new FilterItem(value as IComparable)); 272 | } 273 | else 274 | containsNull = true; 275 | } 276 | 277 | filterList.Sort(); 278 | 279 | if (containsNull) 280 | filterList.Add(new FilterItem(null)); 281 | } 282 | 283 | // open the popup to display this list 284 | popup.DataContext = filterList; 285 | CollectionViewSource.GetDefaultView(filterList).Refresh(); 286 | popup.IsOpen = true; 287 | 288 | // connect to the selection change event 289 | ListView listView = (ListView)popup.Child; 290 | listView.SelectionChanged += SelectionChangedHandler; 291 | } 292 | } 293 | } 294 | 295 | /// 296 | /// Applies the current filter to the list which is being viewed 297 | /// 298 | void ApplyCurrentFilters() 299 | { 300 | if (currentFilters.Count == 0) 301 | { 302 | Items.Filter = ExtraFilter; 303 | return; 304 | } 305 | 306 | Items.Filter = item => 307 | { 308 | bool accept = currentFilters.Values.All(f => f.IsMatch(item)); 309 | if (accept && ExtraFilter != null) 310 | accept = ExtraFilter(item); 311 | return accept; 312 | }; 313 | } 314 | 315 | /// 316 | /// Handles the selection change event from the filter popup 317 | /// 318 | /// 319 | /// 320 | protected void SelectionChangedHandler(object sender, SelectionChangedEventArgs e) 321 | { 322 | // obtain the term to filter for 323 | ListView filterListView = (ListView)sender; 324 | FilterItem filterItem = (FilterItem)filterListView.SelectedItem; 325 | 326 | // navigate up to the header to obtain the filter property name 327 | GridViewColumnHeader header = (GridViewColumnHeader)Helpers.FindElementOfTypeUp(filterListView, typeof(GridViewColumnHeader)); 328 | 329 | SortableGridViewColumn column = (SortableGridViewColumn)header.Column; 330 | String currentFilterProperty = column.SortPropertyName; 331 | 332 | if (!column.CanBeFiltered) 333 | { 334 | FilterStruct filter = (FilterStruct)currentFilters[currentFilterProperty]; 335 | filter.Button.Visibility = System.Windows.Visibility.Hidden; 336 | 337 | return; 338 | } 339 | if (filterItem == null) 340 | return; 341 | 342 | // determine whether to clear the filter for this column 343 | if (filterItem.ItemView.Equals("[clear]")) 344 | { 345 | if (currentFilters.ContainsKey(currentFilterProperty)) 346 | { 347 | FilterStruct filter = (FilterStruct)currentFilters[currentFilterProperty]; 348 | filter.Button.ContentTemplate = (DataTemplate)dictionary["filterButtonInactiveTemplate"]; 349 | if (FilterButtonInactiveStyle != null) 350 | filter.Button.Style = FilterButtonInactiveStyle; 351 | currentFilters.Remove(currentFilterProperty); 352 | } 353 | 354 | ApplyCurrentFilters(); 355 | } 356 | else 357 | { 358 | // find the button and apply the active style 359 | Button button = (Button)Helpers.FindVisualElement(header, "filterButton"); 360 | button.ContentTemplate = (DataTemplate)dictionary["filterButtonActiveTemplate"]; 361 | 362 | if (FilterButtonActiveStyle != null) 363 | button.Style = FilterButtonActiveStyle; 364 | 365 | AddFilter(currentFilterProperty, filterItem, button); 366 | ApplyCurrentFilters(); 367 | } 368 | 369 | // navigate up to the popup and close it 370 | Popup popup = (Popup)Helpers.FindElementOfTypeUp(filterListView, typeof(Popup)); 371 | popup.IsOpen = false; 372 | } 373 | } 374 | } 375 | -------------------------------------------------------------------------------- /SharePointLogViewer/Controls/FiterListViewDictionary.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 33 | 34 | 44 | 45 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |