This is a migrated thread and some comments may be shown as answers.

Dynamically binding columns in Gridview not reflecting with other regions

0 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Arti
Top achievements
Rank 1
Arti asked on 31 Jul 2012, 09:34 AM
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.

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Arti
Top achievements
Rank 1
Share this question
or