private void LoseSearchAreaFocusRectMouseUp(object sender, MouseButtonEventArgs e)
 {
     Panel.SetZIndex(MainWindowOverlayRectangleForSearch, -1);
     SearchTextbox.Text = "Search..";
     Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { BroadcastingList.ItemsSource = broadcastingPeersList; BroadcastingList.Items.Refresh(); }));
     Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { SearchTextbox.SelectAll(); });
 }
        private void SearchTextboxKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key.ToString() == "Escape")
            {
                SearchTextbox.Text = "Search..";
                Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { BroadcastingList.ItemsSource = broadcastingPeersList; BroadcastingList.Items.Refresh(); }));
                Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { SearchTextbox.SelectAll(); });
                return;
            }

            List <PeerDataContainer> _clientsMatchingSearchText = new List <PeerDataContainer>();

            foreach (PeerDataContainer _peer in broadcastingPeersList)
            {
                if (_peer.nick.ToLower().Contains(SearchTextbox.Text.ToLower()))
                {
                    _clientsMatchingSearchText.Add(_peer);
                }
            }

            Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { BroadcastingList.ItemsSource = _clientsMatchingSearchText; BroadcastingList.Items.Refresh(); }));
        }
 private void SearchAreaGotFocus(object sender, RoutedEventArgs e)
 {
     Panel.SetZIndex(MainWindowOverlayRectangleForSearch, 35);
     Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { SearchTextbox.SelectAll(); });
 }