Pages

Wednesday, 9 February 2011

Editable gridview in silverlight

<sdk:DataGrid  x:Name="DgAssignFee" AutoGenerateColumns="False" FontWeight="Bold"
                                       Height="200" Width="600" RowDetailsVisibilityMode="Collapsed" SelectionChanged="DgAssignFee_SelectionChanged"  >
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTemplateColumn Header="Provision Name" Width="200" SortMemberPath="Provision">
                                    <sdk:DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <TextBlock x:Name="TbProvision" Text="{Binding Provision}" FontWeight="Normal"></TextBlock>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellEditingTemplate>
                                </sdk:DataGridTemplateColumn>
                                <sdk:DataGridTemplateColumn Header="Facilities Name" Width="200" SortMemberPath="Residualfee">
                                    <sdk:DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <TextBlock x:Name="TbResidualfee" Text="{Binding Residualfee}" FontWeight="Normal"></TextBlock>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellEditingTemplate>
                                </sdk:DataGridTemplateColumn>

                                <sdk:DataGridTemplateColumn  Width="95">
                                    <sdk:DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <HyperlinkButton x:Name="HyperEdit" Content="Edit" Tag="{Binding Slno}"
                                                FontWeight="Normal" Click="HyperEdit_Click"></HyperlinkButton>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellEditingTemplate>
                                </sdk:DataGridTemplateColumn>
                                <sdk:DataGridTemplateColumn  Width="95">
                                    <sdk:DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <HyperlinkButton x:Name="HyperDelete" Content="Delete" Tag="{Binding Slno}"
                                                FontWeight="Normal" Click="HyperDelete_Click"></HyperlinkButton>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellEditingTemplate>
                                </sdk:DataGridTemplateColumn>
                            </sdk:DataGrid.Columns>

                            <sdk:DataGrid.RowDetailsTemplate>
                                <DataTemplate>
                                    <Border  BorderBrush="Black" BorderThickness="1" CornerRadius="1">
                                        <StackPanel Orientation="Vertical" Background="White" >
                                            <StackPanel Margin="25,10" >
                                                <TextBlock Text="Edit Assign Fees" Height="30" Width="400" ></TextBlock>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal" Margin="20,20">
                                                <TextBlock Text="Provision Name : " Width="150" Height="30"></TextBlock>
                                                <!--<TextBox x:Name="TxtProvision" Text="{Binding Provision}"  FontWeight="Normal" Width="300" TextChanged="TxtProvision_TextChanged"></TextBox>-->
                                                <ComboBox x:Name="CBProvision"   Width="300" Loaded="CBProvision_Loaded" Style="{Binding Provision,Mode=TwoWay}"  FontWeight="Normal" SelectionChanged="CBProvision_SelectionChanged">
                                                </ComboBox>
                                            </StackPanel>
                                           
                                            <StackPanel Orientation="Horizontal" Margin="20,20">
                                                <TextBlock Text="Facilities Name : " Width="150" Height="30"></TextBlock>
                                                <!--<TextBox x:Name="TxtResidualfee" Text="{Binding Residualfee}"  FontWeight="Normal" Width="300" TextChanged="TxtResidualfee_TextChanged"></TextBox>-->
                                                <ComboBox x:Name="CBResidualfee"   Width="300" Loaded="CBResidualfee_Loaded" Style="{Binding Residualfee,Mode=TwoWay}"  FontWeight="Normal" SelectionChanged="CBResidualfee_SelectionChanged">
                                                </ComboBox>
                                            </StackPanel>

                                            <StackPanel>
                                                <StackPanel Orientation="Horizontal" Margin="170,20">
                                                    <Button x:Name="BtnUpdate" Content="Update" Height="30" Width="80"  Click="BtnUpdate_Click"></Button>
                                                    <Button x:Name="BtnClose" Content="Close" Height="30" Width="80" Margin="10,0" Click="BtnClose_Click"></Button>
                                                </StackPanel>
                                            </StackPanel>
                                        </StackPanel>
                                    </Border>
                                </DataTemplate>
                            </sdk:DataGrid.RowDetailsTemplate>
                        </sdk:DataGrid>
                        <sdk:DataPager x:Name="dataPager"
                                    Source="{Binding Path=ItemsSource,ElementName=DgAssignFee}"
                        PageSize="15"    DisplayMode="FirstLastPreviousNext" ></sdk:DataPager>

No comments:

Post a Comment