BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Hi,
I have a
sfDataGrid with three GridTextColumn and two
GridTemplateColumn.CellTemplate (DatePiker) columns. I want to search
and programmatically select in the first column (which is a
GridTextColumn). Using the SearchHelper.Search fails with
NullReferenceExceptions. I think they are cause from searching over
the GridTemplateColumn.
Is it possible to point the SearchHelper to the first column only?
Or how can I export a list from the first
column only to search in manually?
Thanks in advance,
Philipp
public MainWindow()
{
InitializeComponent();
this.dataGrid.SearchHelper = new SearchHelperExt(this.dataGrid);
}
public class SearchHelperExt : SearchHelper
{
public SearchHelperExt(SfDataGrid datagrid)
: base(datagrid)
{
}
protected override bool SearchCell(DataColumnBase column, object record, bool ApplySearchHighlightBrush)
{
if (column == null)
return false;
if (column.GridColumn.MappingName == "OrderID")
{
return base.SearchCell(column, record, ApplySearchHighlightBrush);
}
else
return false;
}
} |
private void Shift_Click(object sender, RoutedEventArgs e)
{
this.dataGrid.SearchHelper.FindNext(this.TextBox.Text);
this.dataGrid.SelectionController.MoveCurrentCell(this.dataGrid.SearchHelper.CurrentRowColumnIndex);
var recored = this.dataGrid.SelectedItem;
var viewmodel = this.dataGrid.DataContext as ViewModel;
if (previousrowColumnIdex != this.dataGrid.SearchHelper.CurrentRowColumnIndex)
viewmodel.SearchItem.Add(recored);
previousrowColumnIdex = this.dataGrid.SearchHelper.CurrentRowColumnIndex;
} |