Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 DataGrid
hi,all
 
i an doing an windows mobile development. i currently got a datagrid and i want to add another column which is tickbox in the first column. so that i can tick to choose which row i want to select since the datagrid will return many rows. In another word, the data rows returned from the webservice can be clearly shows which rows are the ones i want.
 
many thanks in advance
Posted 23-Jun-13 21:58pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I know nothing about windows mobile development.
But I did the same in wpf yesterday. Maybe you can use it or otherwise say it and I will clean it.
<DataGrid   IsEnabled="True" CanUserResizeRows="False" CanUserDeleteRows="False" Height="200" x:Name="Games_Grid" MaxHeight="400" ItemsSource="{Binding GameOverview}"  FontSize="16" SelectedItem="{Binding SelectedGameOverview}" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"  mvvm:SelectedItemsBehavior.SelectedItemsChangedHandler="{Binding Path=ResultsSelectionChangedCommand}">
            <DataGrid.RowHeaderTemplate>
                <DataTemplate>
                    <Grid>
                        <CheckBox IsChecked="{Binding Path=IsSelected, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor,  AncestorType={x:Type DataGridRow}}}"/>
                    </Grid>
                </DataTemplate>
            </DataGrid.RowHeaderTemplate>
       </DataGrid>
 

The SelectedItemBehavior I have from:
http://stackoverflow.com/questions/1579700/wpf-toolkit-datagrid-multi-select-how-to-get-selecteditems-out[^]
  Permalink  
v2
Comments
codingStar at 24-Jun-13 18:50pm
   
windows development in vs 2008 is more like winform. unfortunately it doesn't have this function. has anyone done this before.
 
thanks anyway

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 265
1 CPallini 235
2 OriginalGriff 233
3 Maciej Los 175
4 George Jonsson 170
0 OriginalGriff 5,305
1 DamithSL 4,382
2 Maciej Los 3,760
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,901


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 24 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100