private static void OnLogSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ListView listView = d as ListView; LogItemCollection collection = e.NewValue as LogItemCollection; listView.ItemsSource = collection; GridView gridView = listView.View as GridView; int count = 0; gridView.Columns.Clear(); foreach (var col in collection.Columns) { var cell = new FrameworkElementFactory(typeof(TextBlock)); cell.SetBinding(TextBlock.TextProperty, new Binding(string.Format("[{0}]", count++))); cell.SetValue(FrameworkElement.MarginProperty, new Thickness(0, 4, 0, 4)); gridView.Columns.Add( new GridViewColumn { Header = new TextBlock { Text = col, FontSize = 11, Margin = new Thickness(5, 4, 5, 4) }, CellTemplate = new DataTemplate { DataType = typeof(LogItemCollection), VisualTree = cell, } }); } }
private void OnTimeZoneChanged() { foreach (LogItem log in _logs) { log.ChangeTimeZone(SelectedTimeZone); } LogItemCollection.Refresh(); DateTimePickerModel.ChangeTimeZone(SelectedTimeZone); }
public static void Log(IEnumerable<ValidationResult> validationResults) { LogItemCollection items = new LogItemCollection(); foreach (ValidationResult result in validationResults) { //rootnode id is altijd de 2e element in de idTree int id = int.Parse(result.IdTree.Split('\\')[1]); items.Add(id, result.Rule.Id); } foreach (LogItem li in items) { Log(li.count, li.rootId, li.rule); } }
public static void SetLogSource(DependencyObject d, LogItemCollection value) { d.SetValue(LogSourceProperty, value); }