/////////////xaml code./////////////////////////////////
<data:DataGrid x:Name="dgPerson" Margin="8" IsReadOnly="True"
LoadingRow="dgPerson_LoadingRow" AutoGenerateColumns="False" Width="425" >
<data:DataGrid.Columns>
<data:DataGridTemplateColumn Width="80" >
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="chkPerson" Click="chkPerson_Click"
VerticalAlignment="Center" IsChecked="false" HorizontalAlignment="Center" HorizontalContentAlignment="Center"/>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
<data:DataGridTextColumn Header="Fee Type" Binding="{Binding Residualfee}" MinWidth="120" Width="SizeToCells" CanUserReorder="True" CanUserSort="True"/>
<data:DataGridTemplateColumn Width="80" Header="Fee" >
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Width="120" Height="30" Name="feeamount" Text="{Binding FeeAmount,Mode=TwoWay}"
></TextBox>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
</data:DataGrid.Columns>
</data:DataGrid>
<data:DataPager x:Name="dataPager1" Width="425" Margin="0,-10,0,0"
Source="{Binding Path=ItemsSource,ElementName=dgPerson}"
PageSize="2" DisplayMode="FirstLastPreviousNext" ></data:DataPager>
//////////////////////////public var////////////////////
//List for Original List of Facilitie
ObservableCollection<AssignFecilitieToProvision> myList;
//List for selected Facilitie
ObservableCollection<AssignFecilitieToProvision> personList = new ObservableCollection<AssignFecilitieToProvision>();
////////////////////////////////chk _clik////////////////////
CheckBox chk = sender as CheckBox;
bool check = chk.IsChecked.Value;
var obj = dgPerson.SelectedItem as AssignFecilitieToProvision;
Facilitie p = chk.DataContext as Facilitie;
if (check)
{
if (!personList.Contains(obj))
personList.Add(obj);
}
else
{
personList.Remove(obj);
}
////////////////save button////////////
foreach (var item in personList)
{
///////////do insert
}
<data:DataGrid x:Name="dgPerson" Margin="8" IsReadOnly="True"
LoadingRow="dgPerson_LoadingRow" AutoGenerateColumns="False" Width="425" >
<data:DataGrid.Columns>
<data:DataGridTemplateColumn Width="80" >
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="chkPerson" Click="chkPerson_Click"
VerticalAlignment="Center" IsChecked="false" HorizontalAlignment="Center" HorizontalContentAlignment="Center"/>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
<data:DataGridTextColumn Header="Fee Type" Binding="{Binding Residualfee}" MinWidth="120" Width="SizeToCells" CanUserReorder="True" CanUserSort="True"/>
<data:DataGridTemplateColumn Width="80" Header="Fee" >
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Width="120" Height="30" Name="feeamount" Text="{Binding FeeAmount,Mode=TwoWay}"
></TextBox>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
</data:DataGrid.Columns>
</data:DataGrid>
<data:DataPager x:Name="dataPager1" Width="425" Margin="0,-10,0,0"
Source="{Binding Path=ItemsSource,ElementName=dgPerson}"
PageSize="2" DisplayMode="FirstLastPreviousNext" ></data:DataPager>
//////////////////////////public var////////////////////
//List for Original List of Facilitie
ObservableCollection<AssignFecilitieToProvision> myList;
//List for selected Facilitie
ObservableCollection<AssignFecilitieToProvision> personList = new ObservableCollection<AssignFecilitieToProvision>();
////////////////////////////////chk _clik////////////////////
CheckBox chk = sender as CheckBox;
bool check = chk.IsChecked.Value;
var obj = dgPerson.SelectedItem as AssignFecilitieToProvision;
Facilitie p = chk.DataContext as Facilitie;
if (check)
{
if (!personList.Contains(obj))
personList.Add(obj);
}
else
{
personList.Remove(obj);
}
////////////////save button////////////
foreach (var item in personList)
{
///////////do insert
}
No comments:
Post a Comment