本文整理汇总了C#中System.Windows.Controls.DataGridRow类的典型用法代码示例。如果您正苦于以下问题:C# DataGridRow类的具体用法?C# DataGridRow怎么用?C# DataGridRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridRow类属于System.Windows.Controls命名空间,在下文中一共展示了DataGridRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataGridPreparingCellForEditEventArgs
/// <summary>
/// Constructs a new instance of these event arguments.
/// </summary>
/// <param name="column">The column of the cell that just entered edit mode.</param>
/// <param name="row">The row container that contains the cell container that just entered edit mode.</param>
/// <param name="editingEventArgs">The event arguments, if any, that led to the cell being placed in edit mode.</param>
/// <param name="cell">The cell container that just entered edit mode.</param>
/// <param name="editingElement">The editing element within the cell container.</param>
public DataGridPreparingCellForEditEventArgs(DataGridColumn column, DataGridRow row, RoutedEventArgs editingEventArgs, FrameworkElement editingElement)
{
_dataGridColumn = column;
_dataGridRow = row;
_editingEventArgs = editingEventArgs;
_editingElement = editingElement;
}
示例2: DataGridCellEditEndingEventArgs
/// <summary>
/// Instantiates a new instance of this class.
/// </summary>
/// <param name="column">The column of the cell that is about to exit edit mode.</param>
/// <param name="row">The row container of the cell container that is about to exit edit mode.</param>
/// <param name="editingElement">The editing element within the cell.</param>
/// <param name="editingUnit">The editing unit that is about to leave edit mode.</param>
public DataGridCellEditEndingEventArgs(DataGridColumn column, DataGridRow row, FrameworkElement editingElement, DataGridEditAction editAction)
{
_dataGridColumn = column;
_dataGridRow = row;
_editingElement = editingElement;
_editAction = editAction;
}
示例3: DataGridRowAutomationPeer
/// <summary>
/// AutomationPeer for DataGridRow
/// </summary>
/// <param name="owner">DataGridRow</param>
public DataGridRowAutomationPeer(DataGridRow owner)
: base(owner)
{
if (owner == null)
{
throw new ArgumentNullException("owner");
}
}
示例4: FormatRow
private void FormatRow(DataGridRow row)
{
Product product = (Product)row.DataContext;
if (product.UnitCost > 100)
row.Background = highlightBrush;
else
row.Background = normalBrush;
}
示例5: DataGridBeginningEditEventArgs
/// <summary>
/// Initializes a new instance of the
/// <see cref="T:System.Windows.Controls.Data.DataGridBeginningEditEventArgs" /> class.
/// </summary>
/// <param name="column">
/// The column that contains the cell to be edited.
/// </param>
/// <param name="row">
/// The row that contains the cell to be edited.
/// </param>
/// <param name="editingEventArgs">
/// Information about the user gesture that caused the cell to enter edit mode.
/// </param>
public DataGridBeginningEditEventArgs(DataGridColumn column,
DataGridRow row,
RoutedEventArgs editingEventArgs)
{
this.Column = column;
this.Row = row;
this.EditingEventArgs = editingEventArgs;
}
示例6: Update
public void Update(DataGridRow row)
{
var record = (Record)row.Item;
var content = GetContent(row);
if (content == null)
{
return;
}
content.Text = record.Properties[_descriptor.Index].ValueAsString;
}
示例7: GridRowNumberConverter_Convert_WhenInputIsEmpty_ReturnsAZero
public void GridRowNumberConverter_Convert_WhenInputIsEmpty_ReturnsAZero()
{
//------------Setup for test--------------------------
var converter = new GridRowNumberConverter();
DataGrid dataGrid = new DataGrid { AutoGenerateColumns = true };
var itemsSource = new List<string> { "Item 1 ", "Item 2" };
dataGrid.ItemsSource = itemsSource;
dataGrid.SelectedItem = itemsSource[0];
var row = new DataGridRow();
//------------Execute Test---------------------------
var result = converter.Convert(row, typeof(string), null, CultureInfo.CurrentCulture);
//------------Assert Results-------------------------
Assert.AreEqual(0, result);
}
示例8: Execute
/// <summary>
/// Collapse/Expands the selected DataGridRow.
/// </summary>
/// <param name="parameter">The DataGridRowHeader</param>
public void Execute(object parameter)
{
var rowHeader = parameter as DataGridRowHeader;
var row = DataGridHelper.FindTemplatedParent<DataGridRow>(rowHeader) as DataGridRow;
if (_prevRow is DataGridRow
&& _prevRow != row
&& DataGridHelper.FindVisualParent<DataGrid>(_prevRow) == DataGridHelper.FindVisualParent<DataGrid>(rowHeader))
{ //collapse the previously selected row
_prevRow.DetailsVisibility = Visibility.Collapsed;
}
if (row.DetailsVisibility == Visibility.Visible)
row.DetailsVisibility = Visibility.Collapsed;
else
row.DetailsVisibility = Visibility.Visible;
_prevRow = row;
}
示例9: SetRowLogo
public void SetRowLogo(DataGrid DtGrid, DataGridRow row, string entityCode)
{
if (DtGrid.ItemsSource == null)
{
return;
}
Image logo = DtGrid.Columns[0].GetCellContent(row).FindName("entityLogo") as Image;
if (logo == null)
{
return;
}
if (Application.Current.Resources["RowLogo" + entityCode] != null)
{
string strPpath = Application.Current.Resources["RowLogo" + entityCode].ToString();
logo.Margin = new Thickness(2, 2, 0, 0);
logo.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(strPpath, UriKind.Relative));
return;
}
SMT.Saas.Tools.PermissionWS.PermissionServiceClient client = new SMT.Saas.Tools.PermissionWS.PermissionServiceClient();
client.GetSysMenuByEntityCodeCompleted += new EventHandler<SMT.Saas.Tools.PermissionWS.GetSysMenuByEntityCodeCompletedEventArgs>(client_GetSysMenuByEntityCodeCompleted);
client.GetSysMenuByEntityCodeAsync(entityCode);
//if (string.IsNullOrEmpty(EntityLogo))
//{
// SMT.Saas.Tools.PermissionWS.PermissionServiceClient client = new SMT.Saas.Tools.PermissionWS.PermissionServiceClient();
// client.GetSysMenuByEntityCodeCompleted += new EventHandler<SMT.Saas.Tools.PermissionWS.GetSysMenuByEntityCodeCompletedEventArgs>(client_GetSysMenuByEntityCodeCompleted);
// client.GetSysMenuByEntityCodeAsync(entityCode, logo);
//}
//else
//{
// logo.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(EntityLogo, UriKind.Relative));
//}
}
示例10: GetIsReadOnly
/// <summary>
/// Gets the is read only flag for the row.
/// </summary>
/// <param name="dataGridRow">The data grid row.</param>
/// <returns><c>true</c> if the row is read only, otherwise <c>false</c>.</returns>
public static bool GetIsReadOnly(DataGridRow dataGridRow)
{
return (bool)dataGridRow.GetValue(IsReadOnlyProperty);
}
示例11: SetMoveDragFormat
/// <summary>
/// Sets the drag format when this instance is being dragged above or below another row.
/// </summary>
/// <param name="dataGridRow">The data grid row.</param>
/// <param name="format">The drag format used when this instance is being dragged above or below another row.</param>
public static void SetMoveDragFormat(DataGridRow dataGridRow, string format)
{
dataGridRow.SetValue(MoveDragFormatProperty, format);
}
示例12: GetIsDeselectionEnabled
/// <summary>
/// Gets the deselection enabled property. If enabled, and the row is clicked while selected, the row is deselected.
/// </summary>
/// <param name="dataGridRow">The data grid row.</param>
/// <returns><c>true</c> if deselecting row when selected and clicked, otherwise <c>false</c>.</returns>
public static bool GetIsDeselectionEnabled(DataGridRow dataGridRow)
{
return (bool)dataGridRow.GetValue(IsDeselectionEnabledProperty);
}
示例13: SetMoveBelowCommand
/// <summary>
/// Sets the command used to move another row below this one using drag and drop.
/// </summary>
/// <param name="dataGridRow">The data grid row.</param>
/// <param name="command">The command to move a row below this instance.</param>
public static void SetMoveBelowCommand(DataGridRow dataGridRow, ICommand command)
{
dataGridRow.SetValue(MoveBelowCommandProperty, command);
}
示例14: SetMoveDragContentTemplate
/// <summary>
/// Sets the content template when this instance is being dragged above or below another row.
/// </summary>
/// <param name="dataGridRow">The data grid row.</param>
/// <param name="value">A data template used when this instance is being dragged above or below another row.</param>
public static void SetMoveDragContentTemplate(DataGridRow dataGridRow, DataTemplate value)
{
dataGridRow.SetValue(MoveDragContentTemplateProperty, value);
}
示例15: GetCellContent
/// <summary>
/// Retrieves the visual tree that was generated for a particular row and column.
/// </summary>
/// <param name="dataGridRow">The row that corresponds to the desired cell.</param>
/// <returns>The element if found, null otherwise.</returns>
public FrameworkElement GetCellContent(DataGridRow dataGridRow)
{
if (dataGridRow == null)
{
throw new ArgumentNullException("dataGridRow");
}
if (_dataGridOwner != null)
{
int columnIndex = _dataGridOwner.Columns.IndexOf(this);
if (columnIndex >= 0)
{
DataGridCell cell = dataGridRow.TryGetCell(columnIndex);
if (cell != null)
{
return cell.Content as FrameworkElement;
}
}
}
return null;
}