本文整理汇总了C#中System.Windows.Controls.DataGridCell类的典型用法代码示例。如果您正苦于以下问题:C# DataGridCell类的具体用法?C# DataGridCell怎么用?C# DataGridCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridCell类属于System.Windows.Controls命名空间,在下文中一共展示了DataGridCell类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GenerateEditingElement
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
NumericUpDown numericUpDown = new NumericUpDown();
ApplyColumnProperties(numericUpDown);
numericUpDown.VerticalAlignment = VerticalAlignment.Center;
return numericUpDown;
}
开发者ID:eolandezhang,项目名称:Diagram,代码行数:7,代码来源:DataGridNumericColumn.cs
示例2: GenerateEditingElement
/// <summary>
/// Gets a <see cref="T:System.Windows.Controls.TextBox" /> 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 text box control that is bound to the column's <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding" /> property value.
/// </returns>
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
TextBox textBox = (TextBox)base.GenerateEditingElement(cell, dataItem);
textBox.GotFocus += this.OnTextBoxGotFocus;
DataGridColumnToolTipHelper.SetToolTip(textBox, this.ToolTip, this.ToolTipTemplate, dataItem);
return textBox;
}
开发者ID:Krisscut,项目名称:InvolvedRCON,代码行数:15,代码来源:DataGridTextColumn.cs
示例3: GenerateElement
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
StackPanel panel = GeneratePanel(dataItem);
panel.Children.Add(base.GenerateElement(cell,dataItem));
return panel;
}
开发者ID:jogibear9988,项目名称:SlGanttChart,代码行数:7,代码来源:GanttExpanderColumn.cs
示例4: GenerateEditingElement
// データ編集用コントロールの設定
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, Object dataItem)
{
TextBox textBox = (TextBox)base.GenerateEditingElement(cell, dataItem);
// 最大桁数
textBox.MaxLength = 5;
// 垂直方向配置
textBox.VerticalContentAlignment = VerticalAlignment.Center;
// 水平方向配置
textBox.HorizontalContentAlignment = HorizontalAlignment.Center;
// IMEを強制的にOFF
textBox.SetValue(InputMethod.IsInputMethodEnabledProperty, false);
// 折り返し表示の禁止
textBox.TextWrapping = TextWrapping.NoWrap;
// Enterによるフォーカス移動
textBox.SetValue(EnterThenNextFocus.EnterThenNextFocusProperty, true);
// フォーカス取得時にテキスト全選択
textBox.SetValue(SelectOnFocus.SelectOnFocusProperty, true);
// 時刻フォーマット変換
textBox.SetValue(TimeFormat.TimeFormatProperty, true);
// 入力可能文字列の制限
textBox.SetValue(InputCharcter.InputCharcterProperty, RegexCheck.InputChar.Time_Only);
// 表示フォーマット
string stringFormat = (String)this.GetValue(DisplayFormat.DisplayFormatProperty);
base.SetStringFormat(textBox, stringFormat);
return textBox;
}
开发者ID:higeneko760414,项目名称:WPFCommon,代码行数:29,代码来源:GridTimeColumn.cs
示例5: GenerateElement
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
if (!string.IsNullOrEmpty(this.Resource) && !string.IsNullOrEmpty(this.CustomResourceFormat))
{
Image icon = UiHelper.CreateIcon(UriResources.GetImage(String.Format(this.CustomResourceFormat,this.Resource)));
return icon;
}
if (!string.IsNullOrEmpty(this.Resource))
{
if (dataItem is KpiView && Resource == "Status")
{
Image icon = UiHelper.CreateIcon(UriResources.GetImage(GetKpiIconByPath(this.Resource,(dataItem as KpiView).StatusGraphic)));
return icon;
}
if (dataItem is KpiView && Resource == "Trend")
{
Image icon = UiHelper.CreateIcon(UriResources.GetImage(GetKpiIconByPath(this.Resource,(dataItem as KpiView).TrendGraphic)));
return icon;
}
}
TextBlock block = new TextBlock();
block.Margin = new Thickness(4.0);
block.VerticalAlignment = VerticalAlignment.Center;
block.Text = dataItem.ToString();
return block;
}
开发者ID:SmallMobile,项目名称:ranet-uilibrary-olap.latest-unstabilized,代码行数:26,代码来源:IconDataGridColumn.cs
示例6: GenerateEditingElement
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
DatePicker picker = new DatePicker();
picker.SetBinding(DatePicker.SelectedDateProperty, this.Binding);
picker.IsDropDownOpen = true;
return picker;
}
开发者ID:jogibear9988,项目名称:SlGanttChart,代码行数:7,代码来源:GanttDateColumn.cs
示例7: GetRowAndColumnIndicesFromGivenCell
private List<Tuple<int, int>> GetRowAndColumnIndicesFromGivenCell(DataGrid dataGrid, DataGridCell cell)
{
List<Tuple<int, int>> cellList = null;
var columnIndex = cell.Column.DisplayIndex;
var parent = VisualTreeHelper.GetParent(cell);
while (parent != null && parent.GetType() != typeof (DataGridRow))
{
parent = VisualTreeHelper.GetParent(parent);
}
if (parent is DataGridRow)
{
var dataGridRow = parent as DataGridRow;
var item = dataGridRow.Item;
if (item != null)
{
var rowIndex = dataGrid.Items.IndexOf(item);
if (rowIndex != -1)
{
cellList = new List<Tuple<int, int>>()
{
new Tuple<int, int>(rowIndex, columnIndex)
};
}
}
}
return cellList;
}
开发者ID:MindTheGap,项目名称:BTrader,代码行数:30,代码来源:ResearchWindow.xaml.cs
示例8: GenerateEditingElement
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
CheckBox checkBox = new CheckBox();
//
checkBox.Margin = new Thickness(0);
ConfigureCheckBox(checkBox);
return checkBox;
}
开发者ID:dfr0,项目名称:moon,代码行数:8,代码来源:DataGridCheckBoxColumn.cs
示例9: DataGridCellAutomationPeer
/// <summary>
/// AutomationPeer for DataGridCell.
/// This automation peer should not be part of the automation tree.
/// It should act as a wrapper peer for DataGridCellItemAutomationPeer
/// </summary>
/// <param name="owner">DataGridCell</param>
public DataGridCellAutomationPeer(DataGridCell owner)
: base(owner)
{
if (owner == null)
{
throw new ArgumentNullException("owner");
}
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:14,代码来源:DataGridCellAutomationPeer.cs
示例10: GenerateElement
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
var binding = new Binding(((Binding)Binding).Path.Path);
binding.Source = dataItem;
var content = new ContentControl();
content.ContentTemplate = (DataTemplate)cell.FindResource(TemplateName);
content.SetBinding(ContentControl.ContentProperty, binding); return content;
}
开发者ID:mukeshdepani,项目名称:ParaRD,代码行数:8,代码来源:CustomBoundColumn.cs
示例11: GenerateElement
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
var element = new DatePicker
{
Style = Application.Current.Resources["DatePickerStyle"] as Style
};
element.SetBinding(DatePicker.SelectedDateProperty, Binding);
return element;
}
开发者ID:Dileriuml,项目名称:PostStore,代码行数:9,代码来源:DateTimeColumn.cs
示例12: GenerateElement
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
FrameworkElement frameworkElement = base.GenerateElement(cell, dataItem);
Binding binding = new Binding(this.ColumnName) {
Source = dataItem
};
frameworkElement.SetBinding(ContentControl.ContentProperty, binding);
return frameworkElement;
}
开发者ID:qjw2bqn,项目名称:Esri-Geometry-Network-Configuration-Manager,代码行数:9,代码来源:RuleDataGridColumn.cs
示例13: GetRowIndex
public static int GetRowIndex(DataGridCell dataGridCell)
{
// Use reflection to get DataGridCell.RowDataItem property value.
PropertyInfo rowDataItemProperty = dataGridCell.GetType().GetProperty("RowDataItem", BindingFlags.Instance | BindingFlags.NonPublic);
DataGrid dataGrid = GetDataGridFromChild(dataGridCell);
return dataGrid.Items.IndexOf(rowDataItemProperty.GetValue(dataGridCell, null));
}
开发者ID:mxinshangshang,项目名称:WPF_Oracle_Operation,代码行数:9,代码来源:MainWindow.xaml.cs
示例14: GenerateEditingElement
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
var checkBox = (CheckBox)base.GenerateEditingElement(cell, dataItem);
checkBox.Checked += checkBox_Checked;
checkBox.Unchecked += checkBox_Unchecked;
return checkBox;
}
开发者ID:aytacozkan,项目名称:OGDI-DataLab,代码行数:9,代码来源:AutoCommitCheckBoxColumn.cs
示例15: GenerateElement
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
var comboBox = base.GenerateElement(cell, cell);
if (ItemsSourceBinding != null)
comboBox.SetBinding(ItemsControl.ItemsSourceProperty, ItemsSourceBinding);
ApplyStyle(false, false, comboBox);
return comboBox;
}
开发者ID:trunghaut1,项目名称:FlatTheme,代码行数:10,代码来源:MaterialDataGridComboBoxColumn.cs
示例16: GenerateEditingElement
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
DatePicker picker = new DatePicker();
picker.MinHeight = 16;
picker.Padding = new Thickness(0);
picker.BorderThickness = new Thickness(0);
picker.SetBinding(DatePicker.SelectedDateProperty, Binding);
picker.IsDropDownOpen = true;
return picker;
}
开发者ID:eolandezhang,项目名称:Diagram,代码行数:10,代码来源:DataGridDateColumn.cs
示例17: GenerateEditingElement
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
var editElement = new ComboBox();
editElement.SetBinding(Selector.SelectedItemProperty, Binding);
var prop = dataItem.GetType().GetProperty(Binding.Path.Path,
BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
Utilities.FillObjects(editElement, prop.PropertyType, new[] { dataItem });
return editElement;
}
开发者ID:yan122725529,项目名称:TripRobot.Crawler,代码行数:10,代码来源:DataGridColumns.cs
示例18: GenerateElement
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
var presenter = new TreeGridExpanderPresenter();
BindingOperations.SetBinding(presenter, ContentControl.ContentProperty, new Binding());
presenter.ContentTemplate = this.CellTemplate;
presenter.ContentTemplateSelector = this.CellTemplateSelector;
return presenter;
}
开发者ID:JeongPyoHam,项目名称:Gabang,代码行数:11,代码来源:TreeGridExpanderColumn.cs
示例19: GenerateElement
/// <summary>
/// Creates the visual tree for text based cells.
/// </summary>
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
TextBlock textBlock = new TextBlock();
SyncProperties(textBlock);
ApplyStyle(/* isEditing = */ false, /* defaultToElementStyle = */ false, textBlock);
ApplyBinding(textBlock, TextBlock.TextProperty);
return textBlock;
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:14,代码来源:DataGridTextColumn.cs
示例20: GenerateEditingElement
/// <summary>
/// Creates the visual tree for text based cells.
/// </summary>
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
{
if (comboBox.Columns.Count == 0)
{
//Add columns to DataGrid columns
for (int i = 0; i < columns.Count; i++)
comboBox.Columns.Add(columns[i]);
}
return comboBox;
}
开发者ID:eolandezhang,项目名称:Diagram,代码行数:14,代码来源:DataGridMultiComboBoxColumn.cs
注:本文中的System.Windows.Controls.DataGridCell类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论