Class TabControlViewModel
This class lets you put multiple PDFViewCtrl's into a tab like control.
You can use the TabControlViewModel.TabControlButtonViewModel property to get a
complimentary view model for Tab Selection.
Note: Always dispose the TabControlViewModel explicitly when done with it, as this will free up the ToolManagers.
Inheritance
System.Object
TabControlViewModel
Assembly: pdftron.PDF.Tools.dll
public class TabControlViewModel : ViewModelBase
Fields
Declaration
protected List<string> _futureAccessListTokensToDelete
Field Value
Type |
Description |
List<System.String> |
|
Declaration
protected bool _savingInProgress
Field Value
Type |
Description |
System.Boolean |
|
Properties
Enable tab Auto Save to ensure the temporary PDF file is saved over time even when
main Auto-Save is disabled
NOTE: It does not save back to the original file, only to the temporary one
Declaration
public bool AutoSaveTabState { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Declaration
public RelayCommand CMDBrowseDocument { get; }
Property Value
Declaration
public RelayCommand CMDCreateDocument { get; }
Property Value
Declaration
public string DefaultImageURL { get; set; }
Property Value
Type |
Description |
System.String |
|
Declaration
public static TabControlViewModel Instance { get; }
Property Value
Choose whether or not the add tab button is enabled or disabled
Declaration
public bool IsAddTabButtonEnabled { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Choose whether or not the add tab button is Visible or Collapsed
Declaration
public bool IsAddTabButtonVisible { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Declaration
public bool IsEnabled { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Flag to indicate when TabControlViewModel has been initialized
Declaration
public static bool IsReady { get; }
Property Value
Type |
Description |
System.Boolean |
|
Choose whether or not Tab Reordering is enabled
Declaration
public bool IsTabReorderEnabled { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Sets whether or not to keep the opened tabs saved when ViewModel
gets deactivated
Declaration
public bool KeepOpenedTabs { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Declaration
public int MaximumItems { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Declaration
public PdfViewCtrlTabInfo OldestViewedTab { get; }
Property Value
Get the number of current opened tabs
Declaration
public int OpenTabs { get; }
Property Value
Type |
Description |
System.Int32 |
|
Declaration
public PdfViewCtrlTabInfo SelectedTab { get; set; }
Property Value
Declaration
public bool ShowFixedItem { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Declaration
public ShowIfModifiedStates ShowIfDocumentModified { get; set; }
Property Value
Declaration
public bool ShowImagePreviews { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Enable or Disable the file path popup when right clicking on a tab
Declaration
public bool ShowTabFileInfo { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Declaration
public ObservableCollection<PdfViewCtrlTabInfo> Tabs { get; set; }
Property Value
Declaration
public TabViewWidthMode TabWidthMode { get; set; }
Property Value
Type |
Description |
TabViewWidthMode |
|
Current selected tab index position
Declaration
public int VisibleTabIndex { get; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
Declaration
public Task AddTabAsync(PdfViewCtrlTabInfo newInfo)
Parameters
Returns
Declaration
public Task<PdfViewCtrlTabInfo> AddTabAsync(StorageFile orig, StorageFile tmp, PDFDoc doc, string title)
Parameters
Type |
Name |
Description |
Windows.Storage.StorageFile |
orig |
|
Windows.Storage.StorageFile |
tmp |
|
PDFDoc |
doc |
|
System.String |
title |
|
Returns
Process the auto save of the opened temporary document
Declaration
protected virtual void AutoSaveTimer_Tick(object sender, object e)
Parameters
Type |
Name |
Description |
System.Object |
sender |
|
System.Object |
e |
|
If the file is already in a tab, activates that tab and returns true. Otherwise, returns false.
This function is virtual as it may not behave as expected with files from all sources, such as remote storage which may create a new temp file each time.
Declaration
public virtual Task<bool> CheckIfFileIsOpenAndActivateAsync(NewDocumentProperties documentProperties)
Parameters
Returns
Type |
Description |
Task<System.Boolean> |
|
Declaration
public Task<bool> CheckIfOriginalIsOpenAndActivateAsync(StorageFile file)
Parameters
Type |
Name |
Description |
Windows.Storage.StorageFile |
file |
|
Returns
Type |
Description |
Task<System.Boolean> |
|
Declaration
Will remove every FutureAccessList item except those that are currently in the tabs.
Override or delete in case you handle this list yourself.
Declaration
public virtual Task CleanUpFutureAccessListAsync()
Returns
Declaration
public Task CloseOldestAddedTabAsync()
Returns
Declaration
public Task CloseOldestViewedTabAsync()
Returns
Declaration
public Task CloseTabAsync(PdfViewCtrlTabInfo item)
Parameters
Returns
Close the tab by index position
Declaration
public Task CloseTabAsync(int index, bool activateNewTab = true)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
The tab position
|
System.Boolean |
activateNewTab |
|
Returns
Declaration
public Task CloseTabImplAsync(PdfViewCtrlTabInfo tab, bool activateNewTab = true)
Parameters
Returns
Check if any of the opened tabs/documents already contain the Storagefile
Declaration
public bool ContainsFile(StorageFile file)
Parameters
Type |
Name |
Description |
Windows.Storage.StorageFile |
file |
File to check
|
Returns
Type |
Description |
System.Boolean |
True if tab control already contains the file, false otherwise
|
Declaration
public bool ContainsFilePath(string filePath)
Parameters
Type |
Name |
Description |
System.String |
filePath |
|
Returns
Type |
Description |
System.Boolean |
|
Makes no tab selected. Reactivate by selecting a tab.
It is up to you to save the document in the current tab before Deactivating it.
Declaration
Declaration
protected virtual Task<StorageFile> GetSavedFileAsync(string token)
Parameters
Type |
Name |
Description |
System.String |
token |
|
Returns
Type |
Description |
Task<Windows.Storage.StorageFile> |
|
Declaration
public Task InitializeInstanceAsync(bool enableTracking = true)
Parameters
Type |
Name |
Description |
System.Boolean |
enableTracking |
|
Returns
Declaration
public void RaisePropertyChangedImpl(string property)
Parameters
Type |
Name |
Description |
System.String |
property |
|
Declaration
protected virtual void RemoveTabFromFutureAccessList(PdfViewCtrlTabInfo tab)
Parameters
Declaration
protected void ReplaceTab(int index, PdfViewCtrlTabInfo newInfo)
Parameters
Declaration
public PdfViewCtrlTabInfo ReplaceTab(int index, StorageFile orig, StorageFile tmp, PDFDoc doc, string title)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
Windows.Storage.StorageFile |
orig |
|
Windows.Storage.StorageFile |
tmp |
|
PDFDoc |
doc |
|
System.String |
title |
|
Returns
Save the state of all opened tabs
Declaration
public void SaveAllTabsState()
Save the state of all opened tabs
Declaration
public void SaveCurrentTabState()
Save current PDF docs (temp and original) for future access (using StorageFile token) if these docs still exist in the current run
Declaration
protected virtual void SaveFilesForFutureUse(PdfViewCtrlTabInfo info)
Parameters
Declaration
public Task SelectTabAsync(PdfViewCtrlTabInfo tab)
Parameters
Returns
Select tab implementation
Declaration
public Task SelectTabImplAsync(int index)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
Tab index
|
Returns
Declaration
protected virtual void SetUpPDFViewCtrlAndTools(PDFViewCtrl ctrl, ToolManager toolManager, Deferral deferral)
Parameters
Type |
Name |
Description |
PDFViewCtrl |
ctrl |
|
ToolManager |
toolManager |
|
Windows.Foundation.Deferral |
deferral |
|
Declaration
public Task ShowLastViewedTabAsync()
Returns
Update the properties of every opened tab/document like File Size and Last Modified Date
Declaration
public Task UpdateFilePropertiesAsync()
Returns
Declaration
protected virtual void UpdateFutureAccessListWithRemovedTabs()
Events
Event is raised when user requests brose a document
Declaration
public event TabControlViewModel.BrowseDocumentRequestedDelegate BrowseDocumentRequested
Event Type
Event is raised when user requests create a new document
Declaration
public event TabControlViewModel.CreateDocumentRequestedDelegate CreateDocumentRequested
Event Type
Declaration
public event ToolManager.ShowingContextMenuHandler ShowToolContextMenu
Event Type
Declaration
public event ToolManager.ShowingPopupMenuHandler ShowToolPopupMenu
Event Type
Event is raised when user requests to close a tab by clicking the tab's close button
Declaration
public event TabControlViewModel.TabCloseRequestDelegate TabCloseRequest
Event Type
Declaration
public event TabControlViewModel.VisibleTabChangedDelegate VisibleTabChanged
Event Type