/// <summary> /// <para> /// Gets the HTML to be used for the design-time representation /// of the control. /// </para> /// </summary> /// <returns> /// <para> /// The design-time HTML. /// </para> /// </returns> protected override String GetDesignTimeNormalHtml() { const int numberOfStaticItems = 5; IEnumerable selectedDataSource = null; String oldDataTextField = null, oldDataValueField = null; bool dummyDataSource = false; DesignerTextWriter htmlWriter = new DesignerTextWriter(true); MobileListItemCollection items = _selectionList.Items; Debug.Assert(items != null, "Items is null in LisControl"); if (items.Count > 0) { _selectionList.Adapter.Render(htmlWriter); } else { MobileListItem[] oldItems = items.GetAll(); int sampleRows = numberOfStaticItems; // try designtime databinding. selectedDataSource = GetResolvedSelectedDataSource(); IEnumerable designTimeDataSource = GetDesignTimeDataSource( selectedDataSource, sampleRows, out dummyDataSource); // If dummy datasource is applied, change the data fields so that // dummy source will be rendered. if (dummyDataSource) { oldDataTextField = _selectionList.DataTextField; oldDataValueField = _selectionList.DataValueField; _selectionList.DataTextField = "Column0"; _selectionList.DataValueField = "Column1"; } try { _selectionList.DataSource = designTimeDataSource; _selectionList.DataBind(); _selectionList.Adapter.Render(htmlWriter); } finally { _selectionList.DataSource = null; _selectionList.Items.SetAll(oldItems); if (dummyDataSource) { _selectionList.DataTextField = oldDataTextField; _selectionList.DataValueField = oldDataValueField; } } } return(htmlWriter.ToString()); }