Example #1
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "MainWindow" /> class.
        /// </summary>
        public MainWindow()
        {
            this.InitializeComponent();
            this.viewModel   = new AtmViewModel();
            this.DataContext = this.viewModel;
            this.Closing    += this.viewModel.ViewClosing;
            this.Closed     += this.viewModel.ViewClosed;

            //// Handle this event to scroll the list to the bottom
            ((INotifyCollectionChanged)this.ListBoxEvents.Items).CollectionChanged += (o, e) =>
            {
                var scrollViewer = this.GetScrollViewer(this.ListBoxEvents);

                if (scrollViewer != null)
                {
                    scrollViewer.ScrollToBottom();
                }
            };
        }
        /// <summary>
        ///   Initializes a new instance of the <see cref = "MainWindow" /> class.
        /// </summary>
        public MainWindow()
        {
            this.InitializeComponent();
            this.viewModel = new AtmViewModel();
            this.DataContext = this.viewModel;
            this.Closing += this.viewModel.ViewClosing;
            this.Closed += this.viewModel.ViewClosed;

            //// Handle this event to scroll the list to the bottom
            ((INotifyCollectionChanged)this.ListBoxEvents.Items).CollectionChanged += (o, e) =>
                {
                    var scrollViewer = this.GetScrollViewer(this.ListBoxEvents);

                    if (scrollViewer != null)
                    {
                        scrollViewer.ScrollToBottom();
                    }
                };
        }