- 2026-07-17 V1.4.2 Se añade compatibilidad con CardView

This commit is contained in:
2026-07-19 09:40:21 +02:00
parent f75f7a9022
commit 9aa0a5891f
5 changed files with 171 additions and 161 deletions

View File

@@ -1034,9 +1034,9 @@ Public MustInherit Class tsUserControl
ObjetosSeleccionables.Add(os)
AddHandler tsgc.GotFocus, AddressOf _ObtieneFoco
AddHandler tsgc.PreviewKeyDown, AddressOf _tsgc_PreviewkeyDown
Dim tv As TableView = tsgc.View
AddHandler tv.ValidateRow, AddressOf _tv_ValidateRow
AddHandler tv.InvalidRowException, AddressOf _tv_InvvalidRowException
Dim tv As TableView = TryCast(tsgc.View, TableView)
If tv IsNot Nothing Then AddHandler tv.ValidateRow, AddressOf _tv_ValidateRow
If tv IsNot Nothing Then AddHandler tv.InvalidRowException, AddressOf _tv_InvvalidRowException
'AddHandler tsgc.PreviewKeyDown, AddressOf ObjetosSeleccionables_PreviewKeyDown
For Each c In tsgc.Columns
If c.EditSettings Is Nothing Then c.EditSettings = New DevExpress.Xpf.Editors.Settings.TextEditSettings
@@ -1317,7 +1317,7 @@ Public MustInherit Class tsUserControl
Dim mi As MenuItem = sender
Dim cm As ContextMenu = mi.Parent
Dim tsgc As tsGridControl = cm.PlacementTarget
Dim vista As TableView = tsgc.View
Dim vista As DataViewBase = tsgc.View
Try
If Not tsgc.LanzaAntesEliminar(tsgc) Then
@@ -1332,7 +1332,11 @@ Public MustInherit Class tsUserControl
Next
For Each rw In tsgc.GetSelectedRowHandles
Try
vista.DeleteRow(rw)
If vista.GetType = GetType(TableView) Then
DirectCast(vista, TableView).DeleteRow(rw)
Else
DirectCast(vista, CardView).DeleteRow(rw)
End If
Catch ex As Exception
End Try
Next
@@ -1348,7 +1352,12 @@ Public MustInherit Class tsUserControl
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
vista.DeleteRow(vista.FocusedRowHandle)
If vista.GetType = GetType(TableView) Then
DirectCast(vista, TableView).DeleteRow(vista.FocusedRowHandle)
Else
DirectCast(vista, CardView).DeleteRow(vista.FocusedRowHandle)
End If
If ErroresValidacion.Count > 0 Then ErroresValidacion.RellenaErrores()
End If
tsgc.RefreshData()
@@ -1487,9 +1496,10 @@ Public MustInherit Class tsUserControl
If DirectCast(c, tsGridColumn).Imprimible = False Then c.AllowPrinting = True
End If
Next
Dim vista As TableView = tsgc.View
Dim vista As DataViewBase = tsgc.View
Dim tv As TableView = TryCast(vista, TableView)
Dim ModoEnum As Boolean = False
If vista.ShowCheckBoxSelectorColumn AndAlso tsgc.ElementosSeleccionados.Count > 0 AndAlso DXMessageBox.Show("¿Desea exportar solo los elementos seleccionados?", "Atención", MessageBoxButton.YesNo) = MessageBoxResult.Yes Then ModoEnum = True
If tv IsNot Nothing AndAlso tv.ShowCheckBoxSelectorColumn AndAlso tsgc.ElementosSeleccionados.Count > 0 AndAlso DXMessageBox.Show("¿Desea exportar solo los elementos seleccionados?", "Atención", MessageBoxButton.YesNo) = MessageBoxResult.Yes Then ModoEnum = True
Dim sfd As New SaveFileDialog
sfd.FileName = IO.Path.GetDirectoryName("Exportacion") & (tsgc.NombreTablaBase.NothingAVacio & " Exportacion.xlsx").Trim
If ModoEnum Then
@@ -1530,38 +1540,34 @@ Public MustInherit Class tsUserControl
Next
Dim Cancelar = tsgc.LanzaAntesExportar(tsgc)
If Not Cancelar Then
Dim vista As TableView = tsgc.View
'Dim tamvista As Single = 0
'For Each c In vista.VisibleColumns
' tamvista += c.ActualWidth
'Next
' Dim factor As Single = 566.92F / tamvista
Try
'Dim link As New PrintableControlLink(vista)
'link.PaperKind = System.Drawing.Printing.PaperKind.A4
'link.Landscape = True
'link.Margins.Left = 0.5
'link.Margins.Right = 0.5
'link.Margins.Bottom = 0.5
'link.Margins.Top = 0.5
Dim tv As TableView = TryCast(tsgc.View, TableView)
Dim link As New PrintableControlLink(tsgc.View)
link.PaperKind = System.Drawing.Printing.PaperKind.A4
link.Landscape = True
link.Margins.Left = 0.5
link.Margins.Right = 0.5
link.Margins.Bottom = 0.5
link.Margins.Top = 0.5
'Dim vi As New ucVisualizadorInformes()
'link.PageHeaderTemplate = DirectCast(vi.Resources("pageHeaderTemplate"), DataTemplate)
'link.PageFooterTemplate = DirectCast(vi.Resources("pageFooterTemplate"), DataTemplate)
'link.PageHeaderData = tsgc.PropiedadesTSGC
'vista.PrintAutoWidth = False
'link.CreateDocument()
Dim vi As New ucVisualizadorInformes()
link.PageHeaderTemplate = DirectCast(vi.Resources("pageHeaderTemplate"), DataTemplate)
link.PageFooterTemplate = DirectCast(vi.Resources("pageFooterTemplate"), DataTemplate)
link.PageHeaderData = tsgc.PropiedadesTSGC
If tv IsNot Nothing Then tv.PrintAutoWidth = False
link.CreateDocument()
'vi.Visualizador.DocumentSource = link
'Dim docpanel = New DevExpress.Xpf.Docking.DocumentPanel
'Dim tabHeaderPrintInfoControl As New TabHeaderPrintInfoControl() With {.TabName = "Exportación " & tsgc.PropiedadesTSGC.Descripcion}
'docpanel.Caption = tabHeaderPrintInfoControl
'docpanel.Content = vi
'docpanel.ClosingBehavior = DevExpress.Xpf.Docking.ClosingBehavior.ImmediatelyRemove
'Me.GrupoDocumentos.Add(docpanel)
vi.Visualizador.DocumentSource = link
Dim docpanel = New DevExpress.Xpf.Docking.DocumentPanel
Dim tabHeaderPrintInfoControl As New TabHeaderPrintInfoControl() With {.TabName = "Exportación " & tsgc.PropiedadesTSGC.Descripcion}
docpanel.Caption = tabHeaderPrintInfoControl
docpanel.Content = vi
docpanel.ClosingBehavior = DevExpress.Xpf.Docking.ClosingBehavior.ImmediatelyRemove
Me.GrupoDocumentos.Add(docpanel)
'Comun.dm.DockController.Activate(docpanel)
Comun.dm.DockController.Activate(docpanel)