Hi there
I know I can easily bind *to* a grid's active item by setting a binding using the ActiveRecord.DataItem property. However, how can I do it the other way round? I don't see a converter as a solution: The converter does not have a context (the grid), and this context cannot be assigned through a binding property because that would lead to a circular reference (if I declare it first, the binding fails, if I declare it later, the grid does not see the converter):
<UserControl.Resources> <!-- this binding does not work - the grid has not been created yet --> <conv:ActiveGridRowConverter x:Key="rowConverter" Grid="{Binding ElementName=contactGrid, Mode=OneTime}" /></UserControl.Resources><igDP:XamDataGrid x:Name="contactGrid" DataSource="{Binding Path=ContactStore.Contacts}" ActiveRecord="{Binding Path=ActiveContact.Contact, Converter={StaticResource rowConverter}}" />
I'm not sure whether I'm just overlooking the obvious - what's the recommended solution here?
Thanks,
Philipp
Hi Joe
Your assumption is correct (I wanted to go that way because I don't see a simpler solution to setting the active record). However, ActiveContact is part of my view model and therefore unaware of grids or any other UI controls. Is it possible that the grid exposes somewhat of a design flaw here? ActiveRecord is a pretty "WinFormish" strategy and - as it appears - a one way street when it comes to binding objects. IMO, an ActiveItem property was the way to go...
Any idea for a workaround? I honestly can't imagine thatI'm the first person to set the active item through a binding expression
Cheers
Philpp
jrhutch -
Thanks for the message bump.
Actually as it turns out, we are adding a get/set property of type object to the latest version (i.e., 9.2) of XamDataGrid called ActiveDataItem that will allow you to implictly set the ActiveRecord knowing only the data item. Similarly, the ActiveDataItem property will be updated whenever the ActiveRecord changes.
Note that when the current ActiveRecord is anything other than a DataRecord (e.g., a GroupByRecord) then ActiveDataItem will be set to null.
If you attempt to set ActiveDataItem to a value that does not exist in the data, the ActiveRecord property will be unchanged.
This change should be part of the upcoming Service Release which will be available at the end of October.
Thx. Joe
Looking at WPF 9.2 (w/ the service release) and don't see the ActiveDataItem property? Did it get renamed?
Hi Ryan -
I should have been more specific with dates in my previous post :-(. The Service Release containing the new ActiveDataItem property is the October Service Release which is scheduled for internal delivery this friday October 30 barring any delays (which I don't expect). It should be publicly available either late friday or sometime on monday. Sorry for any confusion.
Joe
We're anxiously awaiting this update, any word on when it will be available?
Maybe I'm looking in the wrong place, but I'm not seeing an update.
Hi jrhutch -
The 9.2 October Service Release was posted earlier today at: http://ko.infragistics.com/dotnet/netadvantage/wpf.aspx#Downloads
You will find the link for the 9.2 SR in the section entitled 'Service Releases' on the right hand side of the page.
The SRs for 8.2 and 9.1 can be downloaded from your 'My Keys and Downloads' page after you log into the site.
JoeM
Attached is a simple project that shows 2-way binding to ActiveDataItem working.
Hi, this issue is still a problem for me too.
@Joe : could you provide a test solution to see this functionality working ?
I have a same issue. from activeitem to my INotifyPropertyChanged property, it's working (if i click something, my SelectedObject is changed to the clickedvalue). but when my bound object changed, the activeItem didn't change.
All we are doing is exposing a DependencyProperty so yes 2-way binding should work.
In the Output window are you getting any binding error msgs releating to this?
How is your ObjetCourant implemented? Is it a DependencyProperty or just a CLR property? If a CLR property does the class that exposes it implement INotifyPropertyChanged?
Hi,
Thanks for your answer, but it doesn't solve my problem... Here is my xaml implementation :
<igDP:XamDataGrid x:Name="XamDataGrid1" Theme="Office2k7Black" DataSource="{Binding Path=Sieges, Mode=TwoWay}" ActiveDataItem="{Binding Path=ObjetCourant, Mode=TwoWay, Converter={StaticResource activeDataItemConverter
}}">
And the converter :
public class ActiveDataItemConverter : IValueConverter
{
#region
IValueConverter Members
public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) {
return value;
}
public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) {
#endregion
The Convert method is never hit when I mark it with a breakpoint and modify the binded property... Are you sure that the TwoWay mode is supported ?
Sébastien