Imports Microsoft.VisualBasic Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Text Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Data Imports System.Windows.Documents Imports System.Windows.Input Imports System.Windows.Media Imports System.Windows.Media.Imaging Imports System.Windows.Navigation Imports System.Windows.Shapes Imports DevExpress.Xpf.Printing Imports DevExpress.Xpf.Core Namespace Controles Partial Public Class TabHeaderPrintInfoControl Inherits UserControl Public Property LinkPreviewModel() As LinkPreviewModel Get Return CType(GetValue(LinkPreviewModelProperty), LinkPreviewModel) End Get Set(ByVal value As LinkPreviewModel) SetValue(LinkPreviewModelProperty, value) End Set End Property Public Shared ReadOnly LinkPreviewModelProperty As DependencyProperty = DependencyProperty.Register("LinkPreviewModel", GetType(LinkPreviewModel), GetType(TabHeaderPrintInfoControl), New PropertyMetadata(Nothing, New PropertyChangedCallback(AddressOf OnLinkPreviewModelChanged))) Public Property TabName() As String Get Return CStr(GetValue(TabNameProperty)) End Get Set(ByVal value As String) SetValue(TabNameProperty, value) End Set End Property Public Shared ReadOnly TabNameProperty As DependencyProperty = DependencyProperty.Register("TabName", GetType(String), GetType(TabHeaderPrintInfoControl), New PropertyMetadata(Nothing, New PropertyChangedCallback(AddressOf OnTabNameChanged))) Private Shared Sub OnLinkPreviewModelChanged(ByVal d As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs) CType(d, TabHeaderPrintInfoControl).OnLinkPreviewModelChanged() End Sub Private Shared Sub OnTabNameChanged(ByVal d As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs) CType(d, TabHeaderPrintInfoControl).OnTabNameChanged() End Sub Public Sub New() InitializeComponent() End Sub Private Sub OnLinkPreviewModelChanged() progress.SetBinding(FrameworkElement.VisibilityProperty, New Binding("ProgressVisibility") With {.Source = LinkPreviewModel, .Converter = New BoolToVisibilityConverter()}) progress.SetBinding(ProgressBar.MaximumProperty, New Binding("ProgressMaximum") With {.Source = LinkPreviewModel}) progress.SetBinding(ProgressBar.ValueProperty, New Binding("ProgressValue") With {.Source = LinkPreviewModel, .Mode = BindingMode.OneWay}) End Sub Private Sub OnTabNameChanged() tabNameTextBlock.Text = TabName End Sub End Class End Namespace