public GridSearchCellElement(GridViewColumn column, GridRowElement row)
            : base(column, row)
        {
            this.timer          = new Timer();
            this.timer.Interval = 100;
            this.timer.Tick    += new EventHandler(this.Timer_Tick);
            GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;

            if (rowInfo != null)
            {
                this.timer.Interval                 = rowInfo.SearchDelay;
                rowInfo.PropertyChanged            += new PropertyChangedEventHandler(this.searchRow_PropertyChanged);
                rowInfo.SearchProgressChanged      += new SearchProgressChangedEventHandler(this.searchRow_SearchProgressChanged);
                this.MatchCaseMenuItem.IsChecked    = rowInfo.CaseSensitive;
                this.changingMatchCasemenuItemValue = true;
                this.matchCaseButton.ToggleState    = this.MatchCaseMenuItem.IsChecked ? Telerik.WinControls.Enumerations.ToggleState.On : Telerik.WinControls.Enumerations.ToggleState.Off;
                this.changingMatchCasemenuItemValue = false;
                this.SearchFromCurrentPositionMenuItem.IsChecked = rowInfo.SearchFromCurrentPosition;
                this.SearchTextBox.ShowClearButton = rowInfo.ShowClearButton;
                this.CloseButton.Visibility        = rowInfo.ShowCloseButton ? ElementVisibility.Visible : ElementVisibility.Collapsed;
            }
            this.searchTextBox.KeyDown                   += new KeyEventHandler(this.searchTextBox_KeyDown);
            this.searchTextBox.MouseDown                 += new MouseEventHandler(this.SearchTextBox_MouseDown);
            this.findNextButton.Click                    += new EventHandler(this.findNextButton_Click);
            this.findPreviousButton.Click                += new EventHandler(this.findPreviousButton_Click);
            this.searchTextBox.TextChanged               += new EventHandler(this.searchTextBox_TextChanged);
            this.findNextButton.MouseEnter               += new EventHandler(this.findNextButton_MouseEnter);
            this.findPreviousButton.MouseEnter           += new EventHandler(this.findPreviousButton_MouseEnter);
            this.matchCaseButton.ToggleStateChanged      += new StateChangedEventHandler(this.matchCaseButton_ToggleStateChanged);
            this.optionsButton.DropDownOpening           += new CancelEventHandler(this.OptionsButton_DropDownOpening);
            this.chooseColumnsMenuItem.DropDownClosing   += new RadPopupClosingEventHandler(this.ChooseColumnsMenuItem_DropDownClosing);
            this.matchCaseMenuItem.Click                 += new EventHandler(this.MatchCaseMenuItem_Click);
            this.searchFromCurrentPositionMenuItem.Click += new EventHandler(this.SearchFromCurrentFromPositionMenuItem_Click);
            LocalizationProvider <RadGridLocalizationProvider> .CurrentProviderChanged += new EventHandler(this.RadGridLocalizationProvider_CurrentProviderChanged);
        }
 private void searchTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Return)
     {
         GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;
         if (e.Shift)
         {
             rowInfo.SelectPreviousSearchResult();
         }
         else
         {
             rowInfo.SelectNextSearchResult();
         }
         this.SyncLabelText();
     }
     else
     {
         if (e.KeyCode != Keys.Escape)
         {
             return;
         }
         if (this.searchTextBox.Text.Length > 0)
         {
             this.searchTextBox.Text = string.Empty;
         }
         else
         {
             if (!(this.RowInfo as GridViewSearchRowInfo).CloseOnEscape)
             {
                 return;
             }
             this.RowInfo.IsVisible = false;
         }
     }
 }
        protected override void DisposeManagedResources()
        {
            GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;

            if (rowInfo != null)
            {
                rowInfo.PropertyChanged       -= new PropertyChangedEventHandler(this.searchRow_PropertyChanged);
                rowInfo.SearchProgressChanged -= new SearchProgressChangedEventHandler(this.searchRow_SearchProgressChanged);
            }
            if (this.timer != null)
            {
                this.timer.Tick -= new EventHandler(this.Timer_Tick);
                this.timer.Dispose();
                this.timer = (Timer)null;
            }
            this.searchTextBox.KeyUp                     -= new KeyEventHandler(this.searchTextBox_KeyDown);
            this.searchTextBox.MouseDown                 -= new MouseEventHandler(this.SearchTextBox_MouseDown);
            this.findNextButton.Click                    -= new EventHandler(this.findNextButton_Click);
            this.findPreviousButton.Click                -= new EventHandler(this.findPreviousButton_Click);
            this.searchTextBox.TextChanged               -= new EventHandler(this.searchTextBox_TextChanged);
            this.findNextButton.MouseEnter               -= new EventHandler(this.findNextButton_MouseEnter);
            this.findPreviousButton.MouseEnter           -= new EventHandler(this.findPreviousButton_MouseEnter);
            this.matchCaseButton.ToggleStateChanged      -= new StateChangedEventHandler(this.matchCaseButton_ToggleStateChanged);
            this.optionsButton.DropDownOpening           -= new CancelEventHandler(this.OptionsButton_DropDownOpening);
            this.chooseColumnsMenuItem.DropDownClosing   -= new RadPopupClosingEventHandler(this.ChooseColumnsMenuItem_DropDownClosing);
            this.matchCaseMenuItem.Click                 -= new EventHandler(this.MatchCaseMenuItem_Click);
            this.searchFromCurrentPositionMenuItem.Click -= new EventHandler(this.SearchFromCurrentFromPositionMenuItem_Click);
            LocalizationProvider <RadGridLocalizationProvider> .CurrentProviderChanged -= new EventHandler(this.RadGridLocalizationProvider_CurrentProviderChanged);
            this.UnsubscribeChildMenuItems(this.chooseColumnsMenuItem);
            this.closeButton.Click -= new EventHandler(this.CloseButton_Click);
            base.DisposeManagedResources();
        }
Esempio n. 4
0
        public override Type GetCellType(GridViewColumn column)
        {
            GridViewSearchRowInfo rowInfo = (GridViewSearchRowInfo)this.RowInfo;

            if (column == null)
            {
                return(typeof(GridSearchCellElement));
            }
            return(base.GetCellType(column));
        }
        private void findNextButton_Click(object sender, EventArgs e)
        {
            GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;

            if (rowInfo == null)
            {
                return;
            }
            rowInfo.SelectNextSearchResult();
            this.SyncLabelText();
        }
Esempio n. 6
0
 protected virtual void InitializeTableSearchRow()
 {
     if (this.tableSearchRow != null)
     {
         return;
     }
     this.tableSearchRow = this.CreateSearchRow();
     this.tableSearchRow.SuspendPropertyNotifications();
     this.tableSearchRow.IsVisible = this.ownerTemplate.AllowSearchRow;
     this.tableSearchRow.ResumePropertyNotifications();
     this.systemRows.Add((GridViewSystemRowInfo)this.tableSearchRow);
     this.SynchronizeSearchRowPosition();
 }
        public override void Initialize(GridViewColumn column, GridRowElement row)
        {
            base.Initialize(column, row);
            this.UpdateInfo();
            GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;

            if (rowInfo == null)
            {
                return;
            }
            this.SyncLabelText();
            this.SyncCriteriaToTextBox(rowInfo);
        }
 protected virtual void SyncCriteriaToTextBox(GridViewSearchRowInfo searchRow)
 {
     this.SearchTextBox.TextChanged -= new EventHandler(this.searchTextBox_TextChanged);
     if (string.IsNullOrEmpty(searchRow.SearchCriteria))
     {
         this.SearchTextBox.Text = string.Empty;
     }
     else
     {
         this.SearchTextBox.Text = searchRow.SearchCriteria;
         this.SearchTextBox.TextBoxItem.SelectionStart = searchRow.SearchCriteria.Length;
     }
     this.SearchTextBox.TextChanged += new EventHandler(this.searchTextBox_TextChanged);
 }
        protected virtual void SyncLabelText()
        {
            GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;

            if (rowInfo == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(rowInfo.SearchCriteria))
            {
                this.SearchTextBox.SearchInfoLabel.Text = string.Empty;
            }
            else
            {
                this.SearchTextBox.SearchInfoLabel.Text = string.Format("{0} {1} {2}", (object)(rowInfo.CurrentResultIndex + 1), (object)LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("SearchRowResultsOfLabel"), (object)rowInfo.CurrentSearchResultsCount);
            }
        }
Esempio n. 10
0
 private void searchRow_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "CaseSensitive")
     {
         GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;
         if (this.matchCaseMenuItem.IsChecked == rowInfo.CaseSensitive)
         {
             return;
         }
         this.matchCaseMenuItem.IsChecked = rowInfo.CaseSensitive;
     }
     else if (e.PropertyName == "SearchFromCurrentPosition")
     {
         GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;
         if (this.searchFromCurrentPositionMenuItem.IsChecked == rowInfo.SearchFromCurrentPosition)
         {
             return;
         }
         this.searchFromCurrentPositionMenuItem.IsChecked = rowInfo.SearchFromCurrentPosition;
     }
     else if (e.PropertyName == "ShowClearButton")
     {
         this.searchTextBox.ShowClearButton = (this.RowInfo as GridViewSearchRowInfo).ShowClearButton;
     }
     else if (e.PropertyName == "ShowCloseButton")
     {
         GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;
         if (this.closeButton == null)
         {
             return;
         }
         this.closeButton.Visibility = rowInfo.ShowCloseButton ? ElementVisibility.Visible : ElementVisibility.Collapsed;
     }
     else
     {
         if (!(e.PropertyName == "SearchDelay") || this.timer == null)
         {
             return;
         }
         this.timer.Interval = (this.RowInfo as GridViewSearchRowInfo).SearchDelay;
     }
 }
Esempio n. 11
0
        protected virtual void Search(bool syncCriteria)
        {
            GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo;

            if (rowInfo == null)
            {
                return;
            }
            string criteria = this.RemoveUnicodeControlCharacters(this.SearchTextBox.Text);

            if (!string.IsNullOrEmpty(criteria))
            {
                this.waitingBar.Visibility = ElementVisibility.Visible;
                this.waitingBar.ResetWaiting();
                this.waitingBar.StartWaiting();
            }
            if (syncCriteria)
            {
                this.SyncCriteriaToTextBox(rowInfo);
            }
            rowInfo.Search(criteria);
        }