LicenceManager 2.1c6:
- Aggiustato il taglio dell'ultima riga nel DataGrid anche per SearchProduct
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
DataContext="{StaticResource SearchProductPageVM}">
|
||||
DataContext="{StaticResource SearchProductPageVM}" Loaded="Grid_Loaded">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -77,7 +77,8 @@
|
||||
Grid.Row="3"
|
||||
Style="{StaticResource ParametersComboBox}"/>
|
||||
|
||||
<DataGrid ItemsSource="{Binding SearchResult}"
|
||||
<DataGrid Name="ProductDataGrid"
|
||||
ItemsSource="{Binding SearchResult}"
|
||||
SelectedItem="{Binding SelSearchResult}"
|
||||
AutoGenerateColumns="False"
|
||||
Grid.Row="4"
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
Class SearchProductV
|
||||
Class SearchProductPageV
|
||||
|
||||
'Private Sub Grid_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' Dim visibleRows As Integer = 0
|
||||
' Dim i As Integer = 0
|
||||
' If (ProductDataGrid.Height - ProductDataGrid.ColumnHeaderHeight) Mod ProductDataGrid.RowHeight <> 0 Then
|
||||
' For Each DataGridItem In ProductDataGrid.ItemContainerGenerator.Items ' ContainerFromIndex(i)
|
||||
' If IsUserVisible(CType(ProductDataGrid.ItemContainerGenerator.ContainerFromIndex(i), FrameworkElement), ProductDataGrid) Then
|
||||
' visibleRows += 1
|
||||
' Else
|
||||
' Exit For
|
||||
' End If
|
||||
' i = i + 1
|
||||
' Next
|
||||
' 'If (ClientDataGrid.Height < ClientDataGrid.ColumnHeaderHeight + ClientDataGrid.RowHeight * (visibleRows - 1)) Then
|
||||
' ProductDataGrid.Height = ProductDataGrid.ColumnHeaderHeight + ProductDataGrid.RowHeight * (visibleRows - 1)
|
||||
' 'End If
|
||||
' End If
|
||||
'End Sub
|
||||
Private Sub Grid_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
Dim visibleRows As Integer = 0
|
||||
Dim i As Integer = 0
|
||||
If (ProductDataGrid.Height - ProductDataGrid.ColumnHeaderHeight) Mod ProductDataGrid.RowHeight <> 0 Then
|
||||
For Each DataGridItem In ProductDataGrid.ItemContainerGenerator.Items ' ContainerFromIndex(i)
|
||||
If IsUserVisible(CType(ProductDataGrid.ItemContainerGenerator.ContainerFromIndex(i), FrameworkElement), ProductDataGrid) Then
|
||||
visibleRows += 1
|
||||
Else
|
||||
Exit For
|
||||
End If
|
||||
i = i + 1
|
||||
Next
|
||||
'If (ClientDataGrid.Height < ClientDataGrid.ColumnHeaderHeight + ClientDataGrid.RowHeight * (visibleRows - 1)) Then
|
||||
ProductDataGrid.Height = ProductDataGrid.ColumnHeaderHeight + ProductDataGrid.RowHeight * (visibleRows - 1)
|
||||
'End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Private Function IsUserVisible(element As FrameworkElement, container As FrameworkElement) As Boolean
|
||||
' If Not IsNothing(element) Then
|
||||
' If Not element.IsVisible Then
|
||||
' Return False
|
||||
' End If
|
||||
' Dim bounds As Rect = element.TransformToAncestor(container).TransformBounds(New Rect(0.0, 0.0, element.ActualWidth, element.ActualHeight))
|
||||
' Dim Rect = New Rect(0.0, 0.0, container.ActualWidth, container.ActualHeight)
|
||||
' Return Rect.Contains(bounds.TopLeft) Or Rect.Contains(bounds.BottomRight)
|
||||
' End If
|
||||
' Return False
|
||||
'End Function
|
||||
Private Function IsUserVisible(element As FrameworkElement, container As FrameworkElement) As Boolean
|
||||
If Not IsNothing(element) Then
|
||||
If Not element.IsVisible Then
|
||||
Return False
|
||||
End If
|
||||
Dim bounds As Rect = element.TransformToAncestor(container).TransformBounds(New Rect(0.0, 0.0, element.ActualWidth, element.ActualHeight))
|
||||
Dim Rect = New Rect(0.0, 0.0, container.ActualWidth, container.ActualHeight)
|
||||
Return Rect.Contains(bounds.TopLeft) Or Rect.Contains(bounds.BottomRight)
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user