Select to view content in your preferred language

Total Record Count of datgrid

3885
2
02-13-2015 09:05 PM
Asgharkhan
Regular Contributor

how count total record from Data grid to textblock

this is my data grid

<slData:DataGrid x:Name="FindDetailsDataGrid" AutoGenerateColumns="False" HeadersVisibility="All" Background="White" Visibility="Visible"

                         BorderBrush="Black" BorderThickness="2" SelectionChanged="FindDetails_SelectionChanged"

                         HorizontalScrollBarVisibility="Hidden" Grid.Row="1"

                         IsReadOnly="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"

                         Height="Auto" Width="Auto">

            <slData:DataGrid.Columns>

              

                <slData:DataGridTextColumn Binding="{Binding Path=Value}" Header="Road Names"/>

            </slData:DataGrid.Columns>

        </slData:DataGrid>

        <TextBlock x:Name="Textblock1" HorizontalAlignment="Left" Margin="149,49,0,0" TextWrapping="Wrap" Text="ll" VerticalAlignment="Top" Width="75"/>

Jennifer NeryHab G.

0 Kudos
2 Replies
nakulmanocha
Esri Regular Contributor

You can bind the text property of the TextBlock to Datagrid.Items.Count

https://msdn.microsoft.com/en-us/library/system.windows.controls.itemcollection.count(v=vs.110).aspx

Another way would be to bind directly to itemsource object Count property as it an enumerable object such as List<T> or ObservableCollection<T>

0 Kudos
Asgharkhan
Regular Contributor

Thank you for reply but this is old question. I always work on easy ways.. I did it by very easy way

Textblock.Text =String.Format(selected.features. Count())

Its working

0 Kudos