DevExpress Version: 14.2
Purpose: To create a draggable control browse view
Process:
1, create Documentmanager control: DevExpress.XtraBars.Docking2010.DocumentManager DMUVW;
2, create in the Documentmanager control to add WidgetView:DevExpress.XtraBars.Docking2010.Views.Widget.WidgetView widgetView1;
3. Add document dynamically through code
/// <summary> /// Add document /// </summary> /// <param name= "Doname" ></param> Public void Adddocument (string doname) { new Document (); = Doname; DMUVW.VIEW.DOCUMENTS.ADD (BD); }
Event: Where Uctemp is the custom control
DmUvw.View.QueryControl + = View_querycontrol ; Private void View_querycontrol (object sender, Querycontroleventargs e) { string tempvmename = e.document.caption; New uctemp (tempvmename); = uctemp; }
4. Delete Document by code
/// <summary> ///Delete Document/// </summary> /// <param name= "Doname" ></param> Public voidDeletedocument (stringdoname) { foreach(Basedocument BDinchDmUvw.View.Documents) {if(Bd. Caption = =doname) {DmUvw.View.Documents.Remove (BD); return; } } }
Issue: Deletion of document through code often has a problem, the interface is not refreshed after deletion, such as loading 5 document. Delete each, occasionally one or two document is actually deleted, but the interface shows that the problem is not deleted.
Solution: Multiple trials, and eventually accidental discovery of solutions.
1, increase StackGroup:DevExpress.XtraBars.Docking2010.Views.Widget.StackGroup stackGroup1 in WidgetView1;
2, add each document into the stackGroup1.
/// <summary> /// Add document /// </summary> /// <param name= "Doname" ></param> Public void Adddocument (string doname) { new Document (); = Doname; DMUVW.VIEW.DOCUMENTS.ADD (BD); STACKGROUP1.ITEMS.ADD (BD); }
DevExpress problem Accumulation: Documentmanager problem