- riportate alcune modifiche da ramo correzioni&migliorie
- evitato drag su selezione pezzo
This commit is contained in:
@@ -362,6 +362,9 @@ Public Class BTLPartManagerVM
|
||||
''' Execute the Open. This method is invoked by the OpenCommand.
|
||||
''' </summary>
|
||||
Friend Sub Edit()
|
||||
If Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM) Then
|
||||
Map.refForcedStrategyBTLVM.Init(Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.BTLFeatureM)
|
||||
End If
|
||||
Map.refProjectVM.SetRawPartManagerVisibility(Visibility.Collapsed)
|
||||
Map.refProjectVM.SetStrategyManagerVisibility(Visibility.Visible)
|
||||
Map.refProjectVM.SetSelManagerTab(ProjectVM.StrategyManagerTab.FEATUREMANAGER)
|
||||
|
||||
@@ -5,28 +5,24 @@ Public Class OnlyProdBTLPartListV
|
||||
|
||||
Private m_BTLPartListVM As BTLPartListVM
|
||||
|
||||
Private m_SelectBtn As MouseButton = MouseButton.Left
|
||||
Private m_HighlightBtn As MouseButton = MouseButton.Right
|
||||
|
||||
Private m_NameDataGridType As Type
|
||||
Private s_isDraggingSelectionField As FieldInfo
|
||||
Private s_endDraggingMethod As MethodInfo
|
||||
Private m_DataGridType As Type = GetType(DataGrid)
|
||||
Private m_isDraggingSelectionField As FieldInfo
|
||||
Private m_endDraggingMethod As MethodInfo
|
||||
|
||||
Sub New()
|
||||
' This call is required by the designer.
|
||||
InitializeComponent()
|
||||
' Add any initialization after the InitializeComponent() call.
|
||||
m_BTLPartListVM = DataContext
|
||||
m_NameDataGridType = BTLPart_DataGrid.GetType()
|
||||
' Evita il drag sulla selezione multipla
|
||||
s_isDraggingSelectionField = m_NameDataGridType.GetField("_isDraggingSelection", BindingFlags.Instance Or BindingFlags.NonPublic)
|
||||
s_endDraggingMethod = m_NameDataGridType.GetMethod("EndDragging", BindingFlags.Instance Or BindingFlags.NonPublic)
|
||||
m_isDraggingSelectionField = m_DataGridType.GetField("_isDraggingSelection", BindingFlags.Instance Or BindingFlags.NonPublic)
|
||||
m_endDraggingMethod = m_DataGridType.GetMethod("EndDragging", BindingFlags.Instance Or BindingFlags.NonPublic)
|
||||
End Sub
|
||||
|
||||
Public Sub DataGrid_PreviewMouseMove(sender As Object, e As MouseEventArgs)
|
||||
' Evita il drag sulla selezione multipla
|
||||
If m_SelectBtn = MouseButton.Left AndAlso e.LeftButton = MouseButtonState.Pressed Then
|
||||
If CBool(If(s_isDraggingSelectionField?.GetValue(BTLPart_DataGrid), False)) Then s_endDraggingMethod.Invoke(BTLPart_DataGrid, New Object(-1) {})
|
||||
If e.LeftButton = MouseButtonState.Pressed Then
|
||||
If CBool(If(m_isDraggingSelectionField?.GetValue(BTLPart_DataGrid), False)) Then m_endDraggingMethod.Invoke(BTLPart_DataGrid, New Object(-1) {})
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -52,14 +52,22 @@
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type Optimizer:StrategyFeature}"
|
||||
ItemsSource="{Binding TopologyList}">
|
||||
<StackPanel Style="{StaticResource OnlyProdPartManager_StackPanel}">
|
||||
<TextBlock Text="[" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="{Binding nGrp}" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="-" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="{Binding nPrcDesc}" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="]" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="{Binding sName}" Style="{StaticResource DialogWindow_TextBlock}" Margin="5,0,0,0"/>
|
||||
</StackPanel>
|
||||
<CheckBox IsChecked="{Binding RelativeSource={RelativeSource AncestorType=TreeViewItem}, Path=IsExpanded}">
|
||||
<CheckBox.Template>
|
||||
<ControlTemplate>
|
||||
<Border Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type TreeView}}}">
|
||||
<StackPanel Style="{StaticResource OnlyProdPartManager_StackPanel}">
|
||||
<TextBlock Text="[" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="{Binding nGrp}" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="-" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="{Binding nPrcDesc}" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="]" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
<TextBlock Text="{Binding sName}" Style="{StaticResource DialogWindow_TextBlock}" Margin="5,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</CheckBox.Template>
|
||||
</CheckBox>
|
||||
</HierarchicalDataTemplate>
|
||||
<DataTemplate DataType="{x:Type Optimizer:Topology}">
|
||||
<TextBlock Text="{Binding sName}" Style="{StaticResource DialogWindow_TextBlock}"/>
|
||||
@@ -68,7 +76,7 @@
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
|
||||
<EventSetter Event="PreviewMouseDown" Handler="TreeViewItem_PreviewMouseDown"/>
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
||||
<Setter Property="Focusable" Value="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource StrategyTypeToFocusableConverter}}"/>
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
|
||||
@@ -26,29 +26,6 @@
|
||||
Topology.AvailableStrategyList_View.Refresh()
|
||||
Next
|
||||
End If
|
||||
' Controlla se il clic è avvenuto sulla HEADER o sul TOGGLEBUTTON
|
||||
Dim clickedElement As DependencyObject = e.OriginalSource
|
||||
While Not IsNothing(clickedElement) AndAlso TypeOf clickedElement IsNot TreeViewItem
|
||||
If TypeOf clickedElement Is Primitives.ToggleButton Then
|
||||
' Se il ToggleButton è stato cliccato, espandi o chiudi
|
||||
treeViewItem.IsExpanded = Not treeViewItem.IsExpanded
|
||||
' Se il nodo è chiuso, togli la selezione
|
||||
If Not treeViewItem.IsExpanded Then
|
||||
treeViewItem.IsSelected = False
|
||||
End If
|
||||
e.Handled = True
|
||||
Return
|
||||
End If
|
||||
clickedElement = VisualTreeHelper.GetParent(clickedElement)
|
||||
End While
|
||||
' Se il clic è sul nodo principale, espandi/chiudi
|
||||
If clickedElement Is treeViewItem AndAlso Not treeViewItem.IsSelected Then
|
||||
treeViewItem.IsExpanded = Not treeViewItem.IsExpanded
|
||||
' Se il nodo è chiuso, togli la selezione
|
||||
If Not treeViewItem.IsExpanded Then
|
||||
treeViewItem.IsSelected = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -578,6 +578,20 @@ Public Class StrategyFeature
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bIsExpanded As Boolean
|
||||
Public Property IsExpanded As Boolean
|
||||
Get
|
||||
Return m_bIsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If Not value AndAlso m_TopologyList.Any(Function(x) x.IsSelected) Then
|
||||
' NotifyPropertyChanged(IsExpanded)
|
||||
Else
|
||||
m_bIsExpanded = value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region ' Fields & Propeties
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Reference in New Issue
Block a user