Exemple #1
0
        /// <summary>
        /// Satır içeriği default yükseklik değerinden daha büyükse tüm satırı o yüksekliğe set eder
        /// </summary>
        private void RowBorder_Loaded(object sender, RoutedEventArgs e)
        {
            Border         border = sender as Border;
            ErtGridViewRow row    = border.DataContext as ErtGridViewRow;

            if (border.ActualHeight > row.Height)
            {
                row.Height = border.ActualHeight;
            }

            var binding = new Binding("Height");

            BindingOperations.SetBinding(border, Border.HeightProperty, binding);
        }
Exemple #2
0
        private void OnCellClicked(object sender, MouseButtonEventArgs e)
        {
            Border         cellOutlineBorder = sender as Border;
            ErtGridViewRow row = cellOutlineBorder.DataContext as ErtGridViewRow;

            if (row != null)
            {
                if (this.SelectionUnit == SelectionUnits.FullRow)
                {
                    if (this.SelectedRow != null)
                    {
                        this.SelectedRow.IsSelected = false;
                    }
                    row.IsSelected = true;
                }

                this.SelectedRow = row;
            }

            Border cellInlineBorder = cellOutlineBorder.Child as Border;

            if (cellInlineBorder != null)
            {
                ErtGridViewCell cell = cellInlineBorder.Child as ErtGridViewCell;

                if (cell != null)
                {
                    if (this.SelectionUnit == SelectionUnits.SingleCell)
                    {
                        if (this.SelectedCell != null)
                        {
                            this.SelectedCell.IsSelected = false;
                        }
                        cell.IsSelected = true;
                    }

                    this.SelectedCell = cell;
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Satırları oluşturur, alternate satırları ayarlar ve boyutlarını default'a set eder
        /// </summary>
        private void GenerateRows()
        {
            if (this.DataSource == null)
            {
                this.Rows = new ObservableCollection <ErtGridViewRow>();
                return;
            }

            ObservableCollection <ErtGridViewRow> rows = new ObservableCollection <ErtGridViewRow>();

            int validAlternationCount = 1;

            if (this.AlternationCount > 0)
            {
                validAlternationCount = this.AlternationCount;
            }

            bool alternateToggle = false;
            int  altIndex        = 1;

            foreach (var data in this.DataSource)
            {
                var row = new ErtGridViewRow(data)
                {
                    IsAlternate = alternateToggle
                };

                if (altIndex >= validAlternationCount)
                {
                    alternateToggle = !alternateToggle;
                    altIndex        = 0;
                }

                altIndex++;
                rows.Add(row);
            }

            this.Rows = rows;
        }