private MobileListItem CreateItem(Object dataItem) { MobileListItem listItem = null; String textField = null; String valueField = null; if (_bindFromFields) { if (_dataTextField.Length > 0) { textField = DataBinder.GetPropertyValue(dataItem, _dataTextField, "{0}"); } if (_dataValueField.Length > 0) { valueField = DataBinder.GetPropertyValue(dataItem, _dataValueField, "{0}"); } } else { textField = dataItem.ToString(); } listItem = new MobileListItem(dataItem, textField, valueField); // Use delegated data binding, if specified. if (dataItem != null) { _parent.OnItemDataBind(new ListDataBindEventArgs(listItem, dataItem)); } return(listItem); }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.Remove1"]/*' /> public void Remove(MobileListItem item) { int index = IndexOf(item); if (index >= 0) { RemoveAt(index); } }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.Add"]/*' /> public void Add(MobileListItem item) { item.SetIndex(Items.Count + BaseIndex); Items.Add(item); if (_marked) { item.Dirty = true; } }
public override bool Equals(Object o) { MobileListItem other = o as MobileListItem; if (other != null) { return(Value.Equals(other.Value) && Text.Equals(other.Text)); } return(false); }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.GetAll"]/*' /> public MobileListItem[] GetAll() { int n = Count; MobileListItem[] result = new MobileListItem[n]; if (n > 0) { Items.CopyTo (0, result, 0, n); } return result; }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.GetAll"]/*' /> public MobileListItem[] GetAll() { int n = Count; MobileListItem[] result = new MobileListItem[n]; if (n > 0) { Items.CopyTo(0, result, 0, n); } return(result); }
private void CreateControlItem( MobileListItemType itemType, ITemplate itemTemplate, bool doDataBind) { if (itemTemplate != null) { MobileListItem item = new MobileListItem(itemType); AddItemAsControl(-1, item, itemTemplate, doDataBind); } }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.Insert1"]/*' /> public void Insert(int index, MobileListItem item) { Items.Insert(index, item); for (int i = index; i < Items.Count; i++) { ((MobileListItem)Items[i]).SetIndex(i + BaseIndex); } if (_marked) { _saveAll = true; } }
private void AddItemAsControl( int itemIndex, MobileListItem item, ITemplate itemTemplate, bool doDataBind) { if (itemTemplate != null) { item.Controls.Clear(); CheckedInstantiateTemplate (itemTemplate, item, this); Controls.Add(item); if (doDataBind) { item.DataBind(); } } }
/* * internal int DataSourceCount * { * get * { * if (_dataSourceCount == -1) * { * IEnumerable dataSource = ResolvedDataSource; * if (dataSource != null) * { * ICollection collection = dataSource as ICollection; * if (collection != null) * { * _dataSourceCount = collection.Count; * } * else * { * int count = 0; * IEnumerator enumerator = dataSource.GetEnumerator(); * while (enumerator.MoveNext()) * { * count++; * } * _dataSourceCount = count; * } * } * else * { * _dataSourceCount = 0; * } * } * return _dataSourceCount; * } * } */ internal /*public*/ void CreateItems(IEnumerable dataSource) { Debug.Assert(dataSource != null); Items.Clear(); _dataTextField = DataTextField; _dataValueField = DataValueField; _bindFromFields = (_dataTextField.Length > 0) || (_dataValueField.Length > 0); foreach (Object dataItem in dataSource) { MobileListItem listItem = CreateItem(dataItem); if (listItem != null) { AddItem(listItem); } } _dataSourceCount = Items.Count; }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.SetAll"]/*' /> public void SetAll(MobileListItem[] value) { Items = new ArrayList (value); if (_marked) { _saveAll = true; } int count = Count; for (int i = 0; i < count; i++) { MobileListItem item = this[i]; item.SetIndex(i + BaseIndex); if (_marked) { item.Dirty = true; } } }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.SetAll"]/*' /> public void SetAll(MobileListItem[] value) { Items = new ArrayList(value); if (_marked) { _saveAll = true; } int count = Count; for (int i = 0; i < count; i++) { MobileListItem item = this[i]; item.SetIndex(i + BaseIndex); if (_marked) { item.Dirty = true; } } }
private void EnsureCount(int count) { int diff = Count - count; if (diff > 0) { Items.RemoveRange(count, diff); if (_marked) { _saveAll = true; } } else { for (int i = Count; i < count; i++) { MobileListItem item = new MobileListItem(); item.SetIndex(i + BaseIndex); Add(item); } } }
private void AddItemAsControl( int itemIndex, MobileListItem item, ITemplate itemTemplate, bool doDataBind) { if (itemTemplate != null) { // No need to do it again, since CreateItems already does it. item.Controls.Clear(); item.ID = null; Controls.Add(item); CheckedInstantiateTemplate (itemTemplate, item, this); if (doDataBind) { item.DataBind(); } } }
internal ItemTreeNode(string itemText) : base(itemText) { this._valueSet = false; this._runtimeItem = new MobileListItem(); this._value = null; this._selected = false; }
internal ItemTreeNode(MobileListItem runtimeItem) : base(runtimeItem.get_Text()) { this._valueSet = false; this._valueSet = true; this._runtimeItem = runtimeItem; this._value = this._runtimeItem.get_Value(); this._selected = this._runtimeItem.get_Selected(); }
public ListCommandEventArgs(MobileListItem item, Object commandSource, CommandEventArgs originalArgs) : base(originalArgs) { _item = item; _commandSource = commandSource; }
private void RenderListItem (XhtmlMobileTextWriter writer, MobileListItem item) { String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute); String cssClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute); if (Control.ItemsAsLinks) { RenderBeginLink (writer, item.Value, accessKey, Style, cssClass); writer.WriteEncodedText (item.Text); RenderEndLink (writer); } else if (Control.HasItemCommandHandler) { RenderPostBackEventAsAnchor (writer, item.Index.ToString(CultureInfo.InvariantCulture) /*event argument*/, item.Text /*link text*/, accessKey, Style, cssClass); } else { writer.WriteEncodedText (item.Text); } }
/// <summary> /// </summary> internal ItemTreeNode(MobileListItem runtimeItem) : base(runtimeItem.Text) { Debug.Assert(runtimeItem != null, "runtimeItem is null"); _valueSet = true; this._runtimeItem = runtimeItem; this._value = _runtimeItem.Value; this._selected = _runtimeItem.Selected; }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.Contains"]/*' /> public bool Contains(MobileListItem item) { return(Items.Contains(item)); }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.IndexOf"]/*' /> public int IndexOf(MobileListItem item) { return Items.IndexOf(item); }
/// <include file='doc\ListDataBindEventArgs.uex' path='docs/doc[@for="ListDataBindEventArgs.ListDataBindEventArgs"]/*' /> public ListDataBindEventArgs(MobileListItem item, Object dataItem) { _listItem = item; _dataItem = dataItem; }
/// <include file='doc\ListCommandEventArgs.uex' path='docs/doc[@for="ListCommandEventArgs.ListCommandEventArgs1"]/*' /> public ListCommandEventArgs(MobileListItem item, Object commandSource) : base(DefaultCommand, item) { _item = item; _commandSource = commandSource; }
/// <include file='doc\ListCommandEventArgs.uex' path='docs/doc[@for="ListCommandEventArgs.ListCommandEventArgs"]/*' /> public ListCommandEventArgs(MobileListItem item, Object commandSource, CommandEventArgs originalArgs) : base(originalArgs) { _item = item; _commandSource = commandSource; }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.Add"]/*' /> public void Add(MobileListItem item) { item.SetIndex(Items.Count + BaseIndex); Items.Add (item); if (_marked) { item.Dirty = true; } }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.IndexOf"]/*' /> public int IndexOf(MobileListItem item) { return(Items.IndexOf(item)); }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.Contains"]/*' /> public bool Contains(MobileListItem item) { return Items.Contains (item); }
internal /*public*/ void AddItem(MobileListItem item) { MobileListItemCollection items = Items; items.Add(item); }
/// <include file='doc\MobileListItemCollection.uex' path='docs/doc[@for="MobileListItemCollection.Insert1"]/*' /> public void Insert(int index, MobileListItem item) { Items.Insert (index, item); for (int i = index; i < Items.Count; i++) { ((MobileListItem)Items[i]).SetIndex(i + BaseIndex); } if (_marked) { _saveAll = true; } }
private void EnsureCount(int count) { int diff = Count - count; if (diff > 0) { Items.RemoveRange (count, diff); if (_marked) { _saveAll = true; } } else { for (int i = Count; i < count; i++) { MobileListItem item = new MobileListItem (); item.SetIndex(i + BaseIndex); Add (item); } } }
private MobileListItem CreateItem(Object dataItem) { MobileListItem listItem = null; String textField = null; String valueField = null; if (_bindFromFields) { if (_dataTextField.Length > 0) { textField = DataBinder.GetPropertyValue(dataItem, _dataTextField, "{0}"); } if (_dataValueField.Length > 0) { valueField = DataBinder.GetPropertyValue(dataItem, _dataValueField, "{0}"); } } else { textField = dataItem.ToString(); } listItem = new MobileListItem(dataItem, textField, valueField); // Use delegated data binding, if specified. if (dataItem != null) { _parent.OnItemDataBind(new ListDataBindEventArgs(listItem, dataItem)); } return listItem; }
public ListCommandEventArgs(MobileListItem item, Object commandSource) : base(DefaultCommand, item) { _item = item; _commandSource = commandSource; }