Пример #1
0
        /// <summary>
        /// Gets a read-only <see cref="T:System.Windows.Controls.TextBlock" /> control that is bound to the column's <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value.
        /// </summary>
        /// <param name="cell">The cell that will contain the generated element.</param>
        /// <param name="dataItem">The data item represented by the row that contains the intended cell.</param>
        /// <returns>
        /// A new, read-only text block control that is bound to the column's <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value.
        /// </returns>
        protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
        {
            CheckBox checkBox = (CheckBox)base.GenerateElement(cell, dataItem);

            DataGridColumnToolTipHelper.SetToolTip(checkBox, this.ToolTip, this.ToolTipTemplate, dataItem, null);
            return(checkBox);
        }
Пример #2
0
        /// <summary>
        /// Gets an editable <see cref="T:System.Windows.Controls.TextBox" /> element that is bound to the column's <see cref="P:System.Windows.Controls.DataGridHyperlinkColumn.ContentBinding" /> property value.
        /// </summary>
        /// <param name="cell">The cell that will contain the generated element.</param>
        /// <param name="dataItem">The data item represented by the row that contains the intended cell.</param>
        /// <returns>
        /// A new text box control that is bound to the column's <see cref="P:System.Windows.Controls.DataGridHyperlinkColumn.ContentBinding" /> property value.
        /// </returns>
        protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
        {
            TextBox textBox = (TextBox)base.GenerateEditingElement(cell, dataItem);

            DataGridColumnToolTipHelper.SetToolTip(textBox, this.ToolTip, this.ToolTipTemplate, dataItem);
            return(textBox);
        }
Пример #3
0
        /// <summary>
        /// Gets a read-only combo box control that is bound to the column's <see cref="P:System.Windows.Controls.DataGridComboBoxColumn.SelectedItemBinding" />, <see cref="P:System.Windows.Controls.DataGridComboBoxColumn.SelectedValueBinding" />, and <see cref="P:System.Windows.Controls.DataGridComboBoxColumn.TextBinding" /> values.
        /// </summary>
        /// <param name="cell">The cell that will contain the generated element.</param>
        /// <param name="dataItem">The data item represented by the row that contains the intended cell.</param>
        /// <returns>
        /// A new, read-only combo box control that is bound to the column's <see cref="P:System.Windows.Controls.DataGridComboBoxColumn.SelectedItemBinding" />, <see cref="P:System.Windows.Controls.DataGridComboBoxColumn.SelectedValueBinding" />, and <see cref="P:System.Windows.Controls.DataGridComboBoxColumn.TextBinding" /> values.
        /// </returns>
        protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
        {
            ComboBox comboBox = (ComboBox)base.GenerateEditingElement(cell, dataItem);

            this.ApplyStyle(false, false, comboBox);
            this.ApplyBinding(this.ItemsSourceBinding, comboBox, Selector.ItemsSourceProperty);
            DataGridColumnToolTipHelper.SetToolTip(comboBox, this.ToolTip, this.ToolTipTemplate, dataItem);
            return(comboBox);
        }
Пример #4
0
        /// <summary>
        /// When overridden in a derived class, gets a read-only element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
        /// </summary>
        /// <param name="cell">The cell that will contain the generated element.</param>
        /// <param name="dataItem">The data item that is represented by the row that contains the intended cell.</param>
        /// <returns>
        /// A new read-only element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
        /// </returns>
        protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
        {
            TextBlock textBlock = new TextBlock();

            this.ApplyStyle(false, false, textBlock);
            this.ApplyBinding(textBlock, TextBlock.TextProperty);
            DataGridColumnToolTipHelper.SetToolTip(textBlock, this.ToolTip, this.ToolTipTemplate, dataItem);
            return(textBlock);
        }
Пример #5
0
        /// <summary>
        /// When overridden in a derived class, gets an editing element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
        /// </summary>
        /// <param name="cell">The cell that will contain the generated element.</param>
        /// <param name="dataItem">The data item that is represented by the row that contains the intended cell.</param>
        /// <returns>
        /// A new editing element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
        /// </returns>
        protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
        {
            DatePicker datePicker = new DatePicker();

            this.ApplyStyle(true, false, datePicker);
            this.ApplyBinding(datePicker, DatePicker.SelectedDateProperty);
            DataGridColumnToolTipHelper.SetToolTip(datePicker, this.ToolTip, this.ToolTipTemplate, dataItem);
            return(datePicker);
        }
Пример #6
0
        /// <summary>
        /// Gets a read-only <see cref="T:System.Windows.Documents.Hyperlink" /> element that is bound to the column's <see cref="P:System.Windows.Controls.DataGridHyperlinkColumn.ContentBinding" /> property value.
        /// </summary>
        /// <param name="cell">The cell that will contain the generated element.</param>
        /// <param name="dataItem">The data item represented by the row that contains the intended cell.</param>
        /// <returns>
        /// A new, read-only hyperlink element that is bound to the column's <see cref="P:System.Windows.Controls.DataGridHyperlinkColumn.ContentBinding" /> property value.
        /// </returns>
        protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
        {
            TextBlock textBlock = (TextBlock)base.GenerateElement(cell, dataItem);

            DataGridColumnToolTipHelper.SetToolTip(
                textBlock,
                this.ToolTip,
                this.ToolTipTemplate,
                dataItem,
                "Inlines.FirstInline.NavigateUri");
            return(textBlock);
        }
 /// <summary>
 /// When overridden in a derived class, gets a read-only element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
 /// </summary>
 /// <param name="cell">The cell that will contain the generated element.</param>
 /// <param name="dataItem">The data item that is represented by the row that contains the intended cell.</param>
 /// <returns>
 /// A new read-only element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
 /// </returns>
 protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
 {
     Elysium.Controls.ProgressBar progressBar = new Elysium.Controls.ProgressBar()
     {
         DataContext = dataItem
     };
     this.ApplyStyle(false, false, progressBar);
     this.ApplyBinding(this.LargeChange, progressBar, Elysium.Controls.ProgressBar.LargeChangeProperty);
     this.ApplyBinding(this.Minimum, progressBar, Elysium.Controls.ProgressBar.MinimumProperty);
     this.ApplyBinding(this.Maximum, progressBar, Elysium.Controls.ProgressBar.MaximumProperty);
     this.ApplyBinding(this.SmallChange, progressBar, Elysium.Controls.ProgressBar.SmallChangeProperty);
     this.ApplyBinding(this.State, progressBar, Elysium.Controls.ProgressBar.StateProperty);
     this.ApplyBinding(progressBar, Elysium.Controls.ProgressBar.ValueProperty);
     DataGridColumnToolTipHelper.SetToolTip(cell, this.ToolTip, this.ToolTipTemplate, dataItem);
     return(progressBar);
 }
        /// <summary>
        /// When overridden in a derived class, gets an editing element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
        /// </summary>
        /// <param name="cell">The cell that will contain the generated element.</param>
        /// <param name="dataItem">The data item that is represented by the row that contains the intended cell.</param>
        /// <returns>
        /// A new editing element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
        /// </returns>
        protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
        {
            Slider slider = new Slider()
            {
                DataContext = dataItem
            };

            this.ApplyStyle(true, false, slider);
            this.ApplyBinding(this.LargeChange, slider, Slider.LargeChangeProperty);
            this.ApplyBinding(this.Minimum, slider, Slider.MinimumProperty);
            this.ApplyBinding(this.Maximum, slider, Slider.MaximumProperty);
            this.ApplyBinding(this.SmallChange, slider, Slider.SmallChangeProperty);
            this.ApplyBinding(slider, Slider.ValueProperty);
            DataGridColumnToolTipHelper.SetToolTip(slider, this.ToolTip, this.ToolTipTemplate, dataItem);
            return(slider);
        }
Пример #9
0
        /// <summary>
        /// When overridden in a derived class, gets an editing element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
        /// </summary>
        /// <param name="cell">The cell that will contain the generated element.</param>
        /// <param name="dataItem">The data item that is represented by the row that contains the intended cell.</param>
        /// <returns>
        /// A new editing element that is bound to the <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value of the column.
        /// </returns>
        protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
        {
            TControl control = new TControl()
            {
                AllowSpin           = this.AllowSpin,
                FormatString        = this.FormatString,
                Increment           = this.Increment,
                Maximum             = this.Maximum,
                Minimum             = this.Minimum,
                SelectAllOnGotFocus = this.SelectAllOnGotFocus,
                ShowButtonSpinner   = this.ShowButtonSpinner
            };

            this.ApplyStyle(true, false, control);
            this.ApplyBinding(this.Binding, control, CommonNumericUpDown <TType> .ValueProperty, null);
            DataGridColumnToolTipHelper.SetToolTip(control, this.ToolTip, this.ToolTipTemplate, dataItem);
            return(control);
        }