Dear Experts,
I have 39500 records in a sql table, when i'm showing this data in wpf datagrid
then its take too time.
condistion for form calling...
Case "frmprodmst"
Dim frm_prod As New MyLov
frm_prod.ShowActivated = True
frm_prod.txt_keyword.Focus()
frm_prod.cln_name = "PNAME,PACK,WPACK,PTYPE,PDELETE,VTAXPER,PCODE"
frm_prod.tblname = "mprodmst"
frm_prod.wherecondition = ""
frm_prod.coldisnm = "Name,Pack,Wpack,Type,Deteled,VAT,Code"
frm_prod.Title = "Product Master"
frm_prod.colwd = {200, 40, 40, 40, 40, 40, 40}
frm_prod.Show()
----in mylov form
Public Class MyLov
'============================= Parameter Fields Start
Public cln_name As String
Public tblname As String
Public titleparam As String
Public wherecondition As String
Public coldisnm As String
Public colwd() As Integer
'============================= End
Dim lovcls As New Comlib
Dim colcnt As Integer
Dim colsplit As String()
Dim tnmsplit As String()
Dim sqlstr As String
Dim dv As DataView
Dim dv2 As DataView
Dim dset As DataSet
Dim currentApplication As Application = Application.Current
Dim ch() As String
Dim fnd_value As String
Private Sub MyLov_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
txt_keyword.Focus()
'============================= Parameter receiving Lines Start
dset = currentApplication.Properties("dset") 'Data Set
'============================= Parameter Lines End
colsplit = cln_name.Split(",") ' All param convert into array
colcnt = colsplit.Count ' all column array count for number of column
dv = New DataView(dset.Tables(tblname))
dv2 = New DataView(dv.ToTable(tblname, True, colsplit)) 'dv2 is requare only change the columns sequence
If wherecondition <> "" Then
dv2.RowFilter = wherecondition 'Where condtion
End If
dv2.Sort = colsplit(0).ToString & " ASC"
LovGrid.ItemsSource = dv2
'Below Coding for column Header-------------------------------------------------------
If Not String.IsNullOrEmpty(coldisnm) Then
Dim hd As String()
hd = coldisnm.Split(",")
Dim xi As Integer = 0
For xi = 0 To colcnt - 1 Step 1
LovGrid.Columns(xi).Header = hd(xi)
LovGrid.Columns(xi).Width = colwd(xi)
Next
End If
'--------------------------------------------------------------------------------------------------
LovGrid.Items.Refresh()
LovGrid.SelectedIndex = 0
End Sub
---end
xmal code
<DataGrid VirtualizingStackPanel.IsVirtualizing ="True" EnableColumnVirtualization="True" EnableRowVirtualization="True" AutoGenerateColumns="True" Height="297" HorizontalAlignment="Left"
x:Name="LovGrid" Width="707" SelectedIndex="1" IsTabStop="True" IsReadOnly="True" Canvas.Top="30">
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="Focusable" Value="False" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Blue"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="Pink"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
<TextBlock Text="{Binding}"
Foreground="Black" FontWeight="Bold" Background="White" FontSize="12" FontFamily="Verdana"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.ColumnHeaderStyle>
</DataGrid>
Thanks & Regards Manoj Patel