Welcome to the Xceed Community | Help
Community Search  
More Search Options

Show / Hide InsertionRow by code in master / detail grid

Sort Posts: Previous Next
  •  12-01-2009, 2:39 PM Post no. 25043

    Show / Hide InsertionRow by code in master / detail grid

    Hi to all,

    I use the wpf datagrid control in a master / detail szenario (bound to a dataset with 4 levels). I need to show and hide the insertionrow of each level by code (button click of a button in a header datatemplate of each level). How can I achieve this in code?

     Thank you for your help or any hint you can give me!

    Filed under:
  •  12-03-2009, 1:03 AM Post no. 25067 in reply to 25043

    Re: Show / Hide InsertionRow by code in master / detail grid

    Hello,

        You can create the datatemplate for the insertion row and add and remove it dynamically:

    Datatemplate for insertion row:

      <DataTemplate x:Key="InsertionRow">
              <xcdg:InsertionRow  ReadOnly="False"
                                    Loaded="InsertionRow_Loaded"
                                    EditEnded="InsertionRow_EditEnded"
                                    EditEnding="InsertionRow_EditEnding"
                                    EditBeginning="InsertionRow_EditBeginning" 
                                    Background="Transparent"
                                    EditTriggers="CellIsCurrent"
                                    Margin="1"/>
                    
            </DataTemplate>

    Button Click Event Adding/Removing:

     private void btnAdd_Click(object sender, ExecuteRoutedEventArgs e)
            {
                     try
                {
                       if !TblView.Headers.Contains((DataTemplate)this.Resources["InsertionRow"]))
                    {
                        this.TblView.Headers.Insert(0, ((DataTemplate)this.Resources["InsertionRow"]));
                                        }
                    else
                    {
                        this.TblView.Headers.Remove((DataTemplate)this.Resources["InsertionRow"]);
                        if (btnAdd != null)
                        {
                            btnAdd.IsChecked = false;
                            IsInsertion = false;
                        }
                    }
                }
                catch (Exception)
                {


                }
            }

     whereTblView is property

       public TableflowView TblView
            {
                get
                {
                    return View as TableflowView;
                }
            }
     

     Thanks,

    Paras Sanghani


    Nothing Is Impossible
  •  12-07-2009, 7:12 AM Post no. 25094 in reply to 25067

    Re: Show / Hide InsertionRow by code in master / detail grid

    Thanks a lot, this post helps me!
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.