I Have a XamDataPresenter fill with a dataview :
XDPChAff.DataSource = DsetChAff.Tables[0].DefaultView;
I Bind this xamdatapresenter with a StactPanel :
<StackPanel Grid.Column="1" Grid.Row="1" Name="SPanSaisie" DataContext="{Binding ElementName=XDPChAff, Path=ActiveDataItem }"
And all work fine.
Now , I Want set the ActiveDataItem Automatic par program . How do ?
Tank you CaisseOdev
HI,
If you set the XamDataPresenter's ActiveRecord property, this will also set the ActiveDataItem.
Code Snippet:
xdpgrid1.ActiveRecord = xdpgrid1.Records[0];
Sincerely,MattDeveloper Support Engineer
Thank you
But How to know the Item of the record : xdpgrid1.Records[?] when I know the datarowView to Select.
Cordialement Caisseodev
HI Caiseodev,
The XamDataGrid has GetRecordFromDataItem method, you can use this method to get a Record from the dataitem it is bound to.
Here a help link:
http://help.infragistics.com/NetAdvantage/WPF/2011.2/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v11.2~Infragistics.Windows.DataPresenter.DataPresenterBase~GetRecordFromDataItem.html
Sincerely,
Matt Developer Support Engineer
Thank you for this link , but I want to do the opposite. Find the Item if I Know the DataRowView.
For now , I Make :
int NoItem = 0;
f
{
if (LuCodTier == PassCodChAff)
XDPChAff.ActiveRecord = XDPChAff.Records[NoItem];
return;
}
NoItem++;
MessageBox.Show("Le Code : " + PassCodChAff.ToString() + " est Inconnu !!!" + "\n" +
" Impossible dans ce CAS !!! ");
ButAbandon.Focus();
Maybe there is a better method ?
Thank you CaisseOdeV
No. I Work with my solution.
Sincerely CaisseOdev
HI CaissevOdev,
Please let me know if you need further assistance regarding this issue.
Sincerely, Matt Developer Support Engineer
Thank You
I Stop CaisseOdev
HI CaisseOdev,
You method is not needed. If you want the DataRowView for the ActiveRecord
Use this CodeSnippet:
if (xgrid1.ActiveRecord != null) { DataRecord dr = xgrid1.ActiveRecord as DataRecord; DataRowView drv = dr.DataItem as DataRowView; MessageBox.Show(drv[0].ToString()); }
MattDeveloper Support Engineer