Files
EgtWPFLib5/EgtFloating/EgtFloatingManager.vb
T
Emmanuele Sassi d20d378a1c EgtWPFLib5 :
- Aggiunto MachGroupPanel per la gestione dei gruppi di lavorazione.
- Corretto errore in EgtFloatingTray che faceva sparire i panel se venivano nascosti e poi riattivati.
- Migliorie varie.
2017-04-06 11:20:35 +00:00

112 lines
4.3 KiB
VB.net

' Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
'
' Step 1a) Using this custom control in a XAML file that exists in the current project.
' Add this XmlNamespace attribute to the root element of the markup file where it is
' to be used:
'
' xmlns:MyNamespace="clr-namespace:EgtCamTest1"
'
'
' Step 1b) Using this custom control in a XAML file that exists in a different project.
' Add this XmlNamespace attribute to the root element of the markup file where it is
' to be used:
'
' xmlns:MyNamespace="clr-namespace:EgtCamTest1;assembly=EgtCamTest1"
'
' You will also need to add a project reference from the project where the XAML file lives
' to this project and Rebuild to avoid compilation errors:
'
' Right click on the target project in the Solution Explorer and
' "Add Reference"->"Projects"->[Browse to and select this project]
'
'
' Step 2)
' Go ahead and use your control in the XAML file. Note that Intellisense in the
' XML editor does not currently work on custom controls and its child elements.
'
' <MyNamespace:EgtFloatingManager/>
'
Imports System.Windows.Controls.Primitives
Imports System.Collections.ObjectModel
Namespace EgtFloating
Public Class EgtFloatingManager
Inherits System.Windows.Controls.ItemsControl
Private m_ParentWindow As Window
Public ReadOnly Property ParentWindow As Window
Get
Return m_ParentWindow
End Get
End Property
Private m_FloatingTrayList As New ObservableCollection(Of EgtFloatingTray)
Public Property FloatingTrayList As ObservableCollection(Of EgtFloatingTray)
Get
Return m_FloatingTrayList
End Get
Set(value As ObservableCollection(Of EgtFloatingTray))
value = m_FloatingTrayList
End Set
End Property
Public Shared ReadOnly LastChildFillProperty As DependencyProperty = DependencyProperty.Register("LastChildFill", GetType(Boolean), GetType(EgtFloatingManager), New PropertyMetadata(True))
''' <summary>
''' Property that say if panel is Top dockable
''' </summary>
Public Property LastChildFill() As Boolean
Get
Return CBool(GetValue(LastChildFillProperty))
End Get
Set(ByVal value As Boolean)
SetValue(LastChildFillProperty, value)
End Set
End Property
Private m_EgtFloatingWindowList As New List(Of EgtFloatingWindow)
Friend Property EgtFloatingWindowList As List(Of EgtFloatingWindow)
Get
Return m_EgtFloatingWindowList
End Get
Set(value As List(Of EgtFloatingWindow))
m_EgtFloatingWindowList = value
End Set
End Property
Shared Sub New()
'This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
'This style is defined in themes\generic.xaml
DefaultStyleKeyProperty.OverrideMetadata(GetType(EgtFloatingManager), New FrameworkPropertyMetadata(GetType(EgtFloatingManager)))
End Sub
Sub New()
End Sub
Private Sub Me_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
'm_ParentWindow = Utility.FindAncestor(Of Window)(Me)
m_ParentWindow = Window.GetWindow(Me)
If Me.Items.Count > 0 AndAlso TypeOf Me.Items(Me.Items.Count - 1) Is EgtFloatingTray Then
LastChildFill = False
End If
' PERMETTE DI SPOSTARE LE WINDOW TRAY NEL CASO VENGA SPOSTATA LA MAINWINDOW!!!!!!!
'For TrayIndex = 0 To Me.Items.Count - 1
' If TypeOf Me.Items(TrayIndex) Is EgtFloatingTray Then
' Dim TrayItem As EgtFloatingTray = DirectCast(Me.Items(TrayIndex), EgtFloatingTray)
' AddHandler ParentWindow.LocationChanged, AddressOf TrayItem.Me_LocationChanged
' AddHandler ParentWindow.SizeChanged, AddressOf TrayItem.Me_DimensionChanged
' End If
'Next
End Sub
Private Sub Me_Unloaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Unloaded
For Each EgtFloatingWindow In EgtFloatingWindowList
EgtFloatingWindow.Close()
Next
End Sub
End Class
End Namespace