本文整理匯總了C#中System.Web.UI.WebControls.DataGridItem.MergeStyle方法的典型用法代碼示例。如果您正苦於以下問題:C# DataGridItem.MergeStyle方法的具體用法?C# DataGridItem.MergeStyle怎麽用?C# DataGridItem.MergeStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.UI.WebControls.DataGridItem
的用法示例。
在下文中一共展示了DataGridItem.MergeStyle方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PrepareControlHierarchyForItem
private void PrepareControlHierarchyForItem (DataGridColumn [] cols,
DataGridItem item,
int index,
Style deployStyle)
{
switch (item.ItemType) {
case ListItemType.Header:
if (!ShowHeader) {
item.Visible = false;
break;
}
if (headerStyle != null)
item.MergeStyle (headerStyle);
goto case ListItemType.Separator;
case ListItemType.Footer:
if (!ShowFooter) {
item.Visible = false;
break;
}
if (footerStyle != null)
item.MergeStyle (footerStyle);
goto case ListItemType.Separator;
case ListItemType.Item :
item.MergeStyle (itemStyle);
goto case ListItemType.Separator;
case ListItemType.AlternatingItem:
item.MergeStyle (deployStyle);
goto case ListItemType.Separator;
case ListItemType.SelectedItem:
Style selStyle = new TableItemStyle ();
if ((item.ItemIndex % 2) == 0) {
selStyle.CopyFrom (itemStyle);
} else {
selStyle.CopyFrom (deployStyle);
}
selStyle.CopyFrom (selectedItemStyle);
item.MergeStyle (selStyle);
goto case ListItemType.Separator;
case ListItemType.EditItem:
Style edStyle = new TableItemStyle ();
if ((item.ItemIndex % 2) == 0) {
edStyle.CopyFrom (itemStyle);
} else {
edStyle.CopyFrom (deployStyle);
}
edStyle.CopyFrom (editItemStyle);
item.MergeStyle (edStyle);
goto case ListItemType.Separator;
case ListItemType.Pager:
if (pagerStyle == null)
break;
if (!pagerStyle.Visible)
item.Visible = false;
if (index == 0) {
if (!pagerStyle.IsPagerOnTop) {
item.Visible = false;
break;
}
} else if (!pagerStyle.IsPagerOnBottom) {
item.Visible = false;
break;
}
item.MergeStyle (pagerStyle);
goto case ListItemType.Separator;
case ListItemType.Separator:
TableCellCollection cells = item.Cells;
int cellCount = cells.Count;
if (cellCount > cols.Length)
cellCount = cols.Length;
if (cellCount > 0 && item.ItemType != ListItemType.Pager) {
for (int i = 0; i < cellCount; i++) {
Style colStyle = null;
if (cols [i].Visible) {
switch (item.ItemType) {
case ListItemType.Header:
colStyle = cols [i].HeaderStyleInternal;
break;
case ListItemType.Footer:
colStyle = cols [i].FooterStyleInternal;
break;
default:
colStyle = cols [i].ItemStyleInternal;
break;
}
cells[i].MergeStyle (colStyle);
} else {
cells [i].Visible = false;
}
}
}
//.........這裏部分代碼省略.........
示例2: ApplyItemStyle
void ApplyItemStyle (DataGridItem item)
{
if (item.ItemIndex % 2 != 0)
item.MergeStyle (alt_item_style);
item.MergeStyle (item_style);
ApplyColumnStyle (item.Cells, ListItemType.Item);
}