示例#1
0
        public StatusHistoryWindow(ObservableCollection <StatusChangeLog> statusChangeLog)
        {
            InitializeComponent();

            if (IsWindowStateSet)
            {
                WindowState = _WindowState;
                if (_Left < SystemParameters.VirtualScreenWidth)
                {
                    Left = _Left;
                }
                Top    = _Top;
                Width  = _Width;
                Height = _Height;
            }
            RefreshMaximizeRestoreButton();
            Topmost = ApplicationOptions.IsAlwaysOnTopEnabled;

            _statusHistoryView        = CollectionViewSource.GetDefaultView(statusChangeLog);
            _statusHistoryView.Filter = AddressFilter;
            StatusHistory.ItemsSource = _statusHistoryView;

            ((INotifyCollectionChanged)StatusHistory.Items).CollectionChanged += StatusHistory_CollectionChanged;

            // When initially displaying the window, automatically scroll to the most recent entry.
            if (StatusHistory.Items.Count > 0)
            {
                StatusHistory.ScrollIntoView(StatusHistory.Items[StatusHistory.Items.Count - 1]);
            }
        }
示例#2
0
        public StatusHistoryWindow(ObservableCollection <StatusChangeLog> statusChangeLog)
        {
            InitializeComponent();

            StatusHistory.ItemsSource = statusChangeLog;

            ((INotifyCollectionChanged)StatusHistory.Items).CollectionChanged += StatusHistory_CollectionChanged;

            // When initially displaying the window, automatically scroll to the most recent entry.
            if (StatusHistory.Items.Count > 0)
            {
                StatusHistory.ScrollIntoView(StatusHistory.Items[StatusHistory.Items.Count - 1]);
            }
        }
示例#3
0
 private void StatusHistory_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (StatusHistory.Items.Count > 0)
     {
         // Autoscroll to bottom only if no sorting has been set on any column (default)
         // or if timestamp column [1] is set to sort ascending.
         if (StatusHistory.Columns[1]?.SortDirection != ListSortDirection.Ascending)
         {
             for (int i = 0; i < StatusHistory.Columns.Count; ++i)
             {
                 if (StatusHistory.Columns[i].SortDirection != null)
                 {
                     return;
                 }
             }
         }
         StatusHistory.ScrollIntoView(StatusHistory.Items[StatusHistory.Items.Count - 1]);
     }
 }