BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi
thanks for replying, I try to use the link you send me, it works if I set autocolumn generation to false but right now I am using my own cellrender class to create custom column, my binding data is a dictionary<srting, EntityItem> my entityitem class has fields below
public sealed class EntityItem
{
public object Value { get; private set; }
public object OldValue { get; private set; }
public Type Type { get; private set; }
public string DisplayValue { get; set; }
public Brush Background { get; set; }
public SolidColorBrush AnimateBackground { get; set; }
public Brush Foreground { get; set; }
private void datagrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnArgs e)
{
e.Column = new CerebroTextColumn() { MappingName = "Value.DisplayValue" };
} |
Hi Gnanasownthari
thanks for replying me back, the binding is working correct, I am not binding the whole collection but a single EntityItem object, that's why I customise my SetDisplayBinding function,
<Grid>
<syncfusion:SfDataGrid AllowSorting="True">
</Grid>
<ScrollViewer x:Name="ScrollViewer">
<Grid>
<syncfusion:SfDataGrid >
</Grid>
</ScrollViewer >
So I am wondering if this problem is happening because I am using customised column and cell class. I am following the tutorial of link below, everything is working until I want to apply sorting function. because it also workings when I am using building text column class the code below works fine, I am thinking is that because sorting is not supported in customised cell class, or did I missing something?
<Syncfusion:SfDataGrid.Columns>
<Syncfusion:GridTextColumn MappingName="NetOpenPos.DisplayValue" UseBindingValue="True"/>
<Syncfusion:GridTextColumn MappingName="RealPnL.DisplayValue" UseBindingValue="True"/>
</Syncfusion:SfDataGrid.Columns>
I have been searching around for quite a long time and haven't got any clues to solve this. the temporary fix is wrapp datagrid inside ScrollViewer, but is makes my program very slow
best
lee
Hi Gnanasownthari
please check my previous reply, and in order to let me have better idea how to recreate the problem I just modified your code by adding more initial items and make the height of datagrid smaller you can see the duplated problem and missing data.
best
lee
public virtual void SetDisplayBinding(TextBox element, GridColumn column, objectdataContext)
{
var customColumn = (CerebroTextColumn)column;
var binding = new System.Windows.Data.Binding
{
Path = new PropertyPath(customColumn.Propertyvalue + ".DisplayValue"),
//Source = dataContext,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
Converter = new NumberConverter()
};
element.SetBinding(TextBox.TextProperty, binding);
var fgBinding = new System.Windows.Data.Binding
{
Path = new PropertyPath(customColumn.Propertyvalue + ".Foreground"),
//Source = dataContext,
};
element.SetBinding(TextBox.ForegroundProperty, fgBinding);
var dgBinding = new System.Windows.Data.Binding
{
Path = new PropertyPath(customColumn.Propertyvalue + ".Background"),
//Source = dataContext,
};
element.SetBinding(TextBox.BackgroundProperty, dgBinding);
}
} |
public override bool CanUpdateBinding(GridColumn column)
{
//If you set the source in binding need to override this method and return true.
return true;
} |
Thanks Gnanasownthari , it works and really appreciate for your help! save us a lot of time
best
lee