Friday, February 13, 2015

FlexDocumentTabSheet




FlexDocumentTabSheet class
It represents a container that contains multiple documents which share the same space on the screen.
Remarks
The FlexDocumentTabSheet is useful for minimizing screen space usage while allowing an application to expose a large amount of data. A FlexDocumentTabSheet consists of at least two FlexDocument objects that share the same screen space. Only one FlexDocument in a FlexDocumentTabSheet is visible at a time. When a user select the tab of a FlexDocument, the contents of that FlexDocument become visible and the contents of the other FlexDocument objects are hidden.
This class enable user to do the following,
§   Drag a FlexDocument object into another FlexDocument object to form a new FlexDocumentTabSheet sheet.
§   Drag a page out of the sheet by dragging the tab.
§   Drag a FlexDocument into a sheet to make it one page of the sheet.
§   Group several sheets together by click “Group” button at the right upper corner of the sheet. Once sheets are grouped together, user can activate one page of a sheet; the pages with the same page index of all other grouped sheets will be activated.
§   Drag a FlexDocumentTabSheet object and dock it at any place during run time.
Examples
The following example shows how to create a FlexDocumentTabSheet object.
public partial class MyChildDocument1 : FlexDocument
{
// ***** //
public partial class MyChildDocument2 : FlexDocument
{
// ***** //
public partial class Window1 : LinsMDIWindow
      {
public Window1()
{
InitializeComponent();

// Create a child document.
MyChildDocument1 myChild1 = new MyChildDocument1();
// Show the document.
MyChild1.ShowDocument();

// Create another child document.
MyChildDocument2 myChild2 = new MyChildDocument2();
// Show the document.
myChild2.ShowDocument();

// Create a document tabsheet
FlexDocumentTabSheet sheet = new FlexDocumentTabSheet();
// Add child document 1 as one of its pages
sheet.AddPage( myChild1, false );
// Insert child document 2 as the first page
sheet.InsertPage( 0, myChild2, false );
// Show the sheet
sheet.ShowDocument();
}
}

§  Constructors
1)  public FlexDocumentTabSheet()
Remarks
Initialize a new instance of FlexDocumentTabSheet
§  Members
1)  public Rect Bounds { get; }
Remarks
Retrieve both the size and the location of the document sheet including its non-client elements, in pixels, relative to its parent.
2)  public Rect BoundsAtMDIFrame { get; }
Remarks
Retrieve both the size and the location of the document sheet including its non-client elements, in pixels, relative to MDI frame.
3)  public UIElement Content { get; set; }
Remarks
Gets or sets the content of the document sheet. 
4)  public virtual FLEX_DOCKING_ALIGN Dock { get; set; }
Remarks
Gets or sets which border of the main frame is to be docked to and determines how a control is resized with its parent. It can be one of the following values,
§   NONE:             
The control is not docked.
§   TOP:                
The control's top edge is docked to the top of its containing control.
§   BOTTOM:         
The control's bottom edge is docked to the bottom of its containing control.
§   LEFT:              
The control's left edge is docked to the left edge of its containing control.
§   RIGHT:             
The control's right edge is docked to the right edge of its containing control.
5)  public override WindowState DocumentState { get; set; }
Remarks
Gets or sets the state of the document sheet; it can be one of the following values
§   Normal:             
The document sheet is restored.
§   Minimized:                
The document sheet is minimized.
§   Maximized:         
The document sheet is maximized.
6)  public FLEX_DOCUMENTSTYLE DocumentStyle { get; }
Remarks
Retrieve the style of the document sheet; it must be FLEX_DOCUMENT_TABSHEET.
7)  public double Height { get; set; }
Remarks
Gets or sets the height of the sheet. UpdateSize() needs to be called for performing the size change.  This field will be ignored, if the Dock attribute of the sheet is FLEX_DOCKING_ALIGN .LEFT or FLEX_DOCKING_ALIGN .RIGHT.
8)  public virtual ImageSource Icon { get; set; }
Remarks
Gets or sets the icon of the document sheet.
9)  public long ID { get; set; }               
Remarks
A unique number which is larger than FlexConstants.m_nUserDefinedControlStartID (10,000,000) will be automatically generated and assigned to it. If the sheet has at least two pages, then it will never been destroyed, and its layout will be persistent. You can always use LinsUIWPFDockingManager.GetDocumentFromAllPlacesByID() to retrieve its instance, once it is created.
10)public FlexMenu MainMenu { get; set; }               
Remarks
Set the menu of this sheet. If it is set to null, the menu will be removed from the sheet.
11)public FlexRibbonMenu MainRibbonMenu { get; set; }               
Remarks
Set the ribbon menu of this sheet. If it is set to null, the ribbon menu will be removed from the sheet.
12)public override bool NoAnimate { get; set; }
Remarks
Gets or sets the animation ability of the document sheet.
13)public virtual int SelectedIndex { get; set; }
Remarks
Gets or sets the index of the selected page.
14)public virtual FlexDocument SelectedTab { get; }
Remarks
Retrieve the selected page.
15)public int TabCount { get; }
Remarks
Retrieve the number of pages. 
16)public FlexCollection<FlexDocument> TabPages { get; }
Remarks
Retrieve all pages. 
17)public override string Title { get; }
Remarks
Retrieve the caption of the active page.
18)public double Width { get; set; }
Remarks
Gets or sets the width of the sheet. UpdateSize() needs to be called for performing the size change.  This field will be ignored, if the Dock attribute of the sheet is FLEX_DOCKING_ALIGN .TOP or FLEX_DOCKING_ALIGN .BOTTOM.
§  Methods
1)  public void AddPage(
FlexDocument doc,
bool bUsingFirstChildInfo)
Parameters
doc
Type: FlexDocument
The FlexDocument is going to be added into the sheet.
bUsingFirstChildInfo
Type: bool
If the doc is the first and the only page of the sheet at the time, and bUsingFirstChildInfo is true, the sheet will use the doc.’s parameters, such as size, location, and docking style, to create it. If the sheet already has other pages, then this parameter will be ignored. 
Remarks
Add doc into the sheet as a page, and append the page at the bottom.
2)  public virtual void Close()                   
Remarks
Close the sheet. 
3)  public void ClosePage(
int nIndex)
Parameters
nIndex
Type: int
The page index of the page which is going to be close.
Remarks
Close a page.
4)  public void EnsureVisible()                 
Remarks
Move the document sheet into view area if it is outside the view area.
5)  public FlexDocument GetPage (
int nIndex)
Parameters
nIndex
Type: int
The page index.
Remarks
Retrieve the page by its specific position. It will return null, if the index exceeds the range.
6)  public int GetPageIndex(
FlexDocument doc)
Parameters
doc
Type: FlexDocument
A page of the sheet.
Remarks
Retrieve the page index of the page doc. It will return -1, if it is no one of the pages of the sheet.
7)  public int GetPageIndex(
long nPageID)
Parameters
nPageID
Type: long
The page id.
Remarks
Retrieve the page index of a page by its ID. It will return -1, if it is no one of the pages of the sheet.
8)  public FlexDocument[] GetTabPages()
Remarks
Retrieve all pages of the sheet.
9)  public virtual bool HitTest(
Point ptMousePosAtMDIFrame)                 
Parameters
ptMousePosAtMDIFrame
Type: Point
A location which is in MDI Frame coordinate. 
Remarks
Test whether the point, ptMousePosAtMDIFrame, which is in MDI Frame coordinate, is inside this document sheet includes the non-client area.
10)public void InsertPage(
int nIndex,
FlexDocument doc,
bool bUsingFirstChildInfo)
Parameters
nIndex
Type: int
The specific location where the FlexDocument is going to be inserted into the sheet.
doc
Type: FlexDocument
The FlexDocument is going to be added into the sheet.
bUsingFirstChildInfo
Type: bool
If the doc is the first and the only page of the sheet at the time, and bUsingFirstChildInfo is true, the sheet will use the doc.’s parameters, such as size, location, and docking style, to create it. If the sheet already has other pages, then this parameter will be ignored. 
Remarks
Insert doc into the sheet as a page at a specific position.
11)public void RemovePage(
FlexDocument doc)
Parameters
doc
Type: FlexDocument
The page will be removed from the sheet.
Remarks
Remove doc from the sheet.
12)public virtual void RemoveToolBar(
FlexToolBar toolbar)                 
Parameters
toolbar
Type: FlexToolBar
The toolbar is going to be removed from this sheet. 
Remarks
This removes a toolbar from this sheet. 
13)public void SetLocation(
Point ptLoc)
Parameters
ptLoc
Type: Point
A location which is relative its parent coordinates. 
Remarks
Set the location of the sheet, in pixels, relative to its parent. When the sheet is docked, this method will be invalid.
14)public void SetLocationAtMDIFrame(
Point ptMousePosAtMDIFrame)                 
Parameters
ptMousePosAtMDIFrame
Type: Point
A location which is relative to MDI Frame coordinates. 
Remarks
Set the location of the sheet, in pixels, relative to MDI Frame. When the sheet is docked, this method will be invalid.
15)public override bool ShowDocument()               
Remarks
This makes the sheet visible. 
16)public void SwitchPages(
FlexDocument doc1,
FlexDocument doc2)
Parameters
doc1
Type: FlexDocument
The first page whose position will be changed.
doc2
Type: FlexDocument
The second page whose position will be changed.
Remarks
Switch doc1 ‘s position with doc2 ‘s position.
17)public virtual void UpdateSize()                 
Remarks
When width or height of a sheet is changed, this method needs to be called to perform the change.
 §  Events
1)     public event ContentChangedEventhandler ContentChanged              
Remarks
This event is fired when the content is changed. 
2)     public event SelectedIndexChangedEventhandler SelectedIndexChanged              
Remarks
This event is fired when the active page is changed.  


Demo



References:



No comments:

Post a Comment