public void PreviewItemHotKey(KeyEventArgs e)
        {
            if (e.Handled)
            {
                return;
            }

            if (SelectedItem != null && e.Key == Key.Enter)
            {
                ExecuteCommandSource(this);
                return;
            }

            var selectedItem = ActualItemsSource.FirstOrDefault(p => p.HotKey == e.Key);

            if (selectedItem != null)
            {
                SelectedItem = selectedItem;
                if (_list != null && _list.SelectedIndex >= 0)
                {
                    _list.SetSelected(_list.SelectedIndex);
                }
                UpdateEditValue();
                ExecuteCommandSource(this);
                e.Handled = true;
            }
        }
        protected virtual void OnItemsSourceChanged()
        {
            ActualItemsSource = null;
            CurrentIndex      = 0;

            try
            {
                if (ItemsSource == null || ItemsSource.Count == 0)
                {
                    return;
                }

                if (EditValue != null)
                {
                    var item = FindItem(ItemsSource);
                    if (item != null)
                    {
                        var index = ItemsSource.IndexOf(item);
                        if (index >= 0)
                        {
                            var currentIndex = index / MaxRowsOnPage * MaxRowsOnPage;
                            var rows         = TotalRowCount();
                            if (currentIndex > rows)
                            {
                                currentIndex = rows - 1;
                            }
                            CurrentIndex = currentIndex;
                        }
                    }
                }

                ScrollingItems();
                if (ActualItemsSource != null)
                {
                    if (EditValue != null)
                    {
                        SelectedItem = FindItem(ActualItemsSource);
                    }

                    if (SelectedItem == null)
                    {
                        SelectedItem = ActualItemsSource.FirstOrDefault();
                    }

                    if (EditValue == null && SelectedItem != null && SelectedItem.Value != null)
                    {
                        EditValue = SelectedItem.Value.Id;
                    }
                }
            }
            finally
            {
                if (!string.IsNullOrEmpty(TotalRowsDisplayFormat))
                {
                    TotalRowsInfo = string.Format(TotalRowsDisplayFormat, TotalRowCount());
                }
            }
        }
        public ICollection <object> GetRecordsBy(uint StartingIndex, uint NumberOfRecords, object FilterTag)
        {
            if (StartingIndex >= ActualItemsSource.Count())
            {
                return(new List <object>());
            }

            List <object> result = new List <object>();

            for (int i = (int)StartingIndex; i < ActualItemsSource.Count() && i < StartingIndex + NumberOfRecords; i++)
            {
                result.Add(ActualItemsSource.ElementAt(i));
            }

            return(result.ToList <object>());
        }
 public uint GetTotalCount()
 {
     return((uint)ActualItemsSource.Count());
 }