Dynamically binding columns in Gridview not reflecting with other regions

1 posts, 0 answers
  1. Arti
    Arti avatar
    5 posts
    Member since:
    Oct 2011

    Posted 31 Jul 2012 Link to this post

    Creating dynamic column binding of GridView Columns with following,

    public GridViewDataColumn AddCellTemplate(string header, string bindproperty, string namespacevalue, string control, bool isReadonly, bool isResizable, double columnWidthPercentage)
            {
                GridViewDataColumn dgtc = new GridViewDataColumn();
                dgtc.Header = header;
                dgtc.IsReadOnly = isReadonly;
                dgtc.IsResizable = isResizable;
                if (columnWidthPercentage > 0)
                {
                    dgtc.Width = columnWidthPercentage * GridViewActualWidth / 100;
                }
                                 
                Binding objbind = new Binding(bindproperty);
                objbind.Mode = BindingMode.TwoWay;
                dgtc.DataMemberBinding = objbind;
                if (!string.IsNullOrEmpty(control))
                {
                    StringBuilder CellTemp = new StringBuilder();
                    CellTemp.Append("<DataTemplate ");
                    CellTemp.Append("xmlns='http://schemas.microsoft.com/winfx/");
                    CellTemp.Append("2006/xaml/presentation' ");
                    CellTemp.Append("xmlns:syncControls='clr-namespace:Syncoms.BOSuiteSL.Common.Controls;assembly=Syncoms.BOSuiteSL.Common' ");
                    CellTemp.Append("xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' >");
                    CellTemp.Append("<Grid>");
                    CellTemp.Append(control);
                    CellTemp.Append(" Margin='4'/>");
                    CellTemp.Append("</Grid>");
                    CellTemp.Append("</DataTemplate>");
                    DataTemplate dt = XamlReader.Load(CellTemp.ToString()) as DataTemplate;
                    dgtc.CellTemplate = dt;
                }
                return dgtc;      
            }

    If i m changing property then with in region its working fine . But whenver i m clicking on Toolbar' button which is within different region, than its not binding with its property.
Back to Top