Player
{
IsNew, Name, LastName, PlayerNumber
}
I have an ObservableCollection<Player> Players in my ViewModel. My grid is binded to this Players collection
I want to make my column that displays my playernumber enabled depending on my IsNew field
I created a multibinding convertor to pass the value IsNew with some other value on my ViewModel that i need.
I'm having problems passing the IsNew property value to my converter. Binding Path="IsNew" does not work. What do I have to do to pass the entire player object to the converter or just the one field from the player that i need?
<igDP:UnboundField Name="LastName" Label="Last Name" BindingPath="LastName" BindingMode="TwoWay" Width="115" > <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamTextEditor}"> <Setter Property="IsEnabled"> <Setter.Value> <MultiBinding Converter="{StaticResource RosterEdit}"> <Binding Path="IsNew" /> <Binding RelativeSource="{RelativeSource FindAncestor,AncestorType={x:Type core:GlassWindow}}" Path="DataContext.AllowEdit" /> </MultiBinding> </Setter.Value> </Setter> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:UnboundField>
can anyone help me with this?
Hello,
I have been looking into your sample and you can try binging the Value property to the corresponding RecordDataPresernter. You can then set the corresponding DataItem as a Path and this should fix the issue:
<igDP:UnboundField Name="LastName" Label="Last Name" BindingPath="LastName" BindingMode="TwoWay" Width="115" >
<igDP:Field.Settings>
<igDP:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}">
<igDP:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igEditors:XamTextEditor}">
<Setter Property="IsEnabled" >
<Setter.Value>
<MultiBinding Converter="{StaticResource RosterEdit}">
<Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type igDP:DataRecordPresenter}}" Path="Record.DataItem.IsNew" />
<Binding RelativeSource="{RelativeSource FindAncestor,AncestorType={x:Type core:GlassWindow}}" Path="DataContext.AllowEdit" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:UnboundField>
Please let me know if you require additional assistance regarding the discussed matter.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
Thank you so much! Worked beautifully
Another Multibinding question Now I have another scenario: I have a xamcomboeditor
and I am binding it to a collection in my viewmodel (ObservableCollection<Player> Players) I need to be able to customize the display text..so again I'm in the need to format a string and multibind... The code below does not work. what shows is the Objecttype on the display. How do i accomplish this multibinding in the combobox. Note this combobox is not within a grid.
<igEditors:XamComboEditor Grid.Column="1" Grid.Row="2" Name="cbFGPlayer" Width="150" ItemsSource="{Binding PlayerCollection}" SelectedItem="{Binding FieldGoal.Player,NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged}" ValuePath="PlayerId" > <igEditors:XamComboEditor.Template> <ControlTemplate> <TextBlock> <TextBlock.Text> <MultiBinding StringFormat=" {0} - {1}, {2} ({3}) "> <Binding Path="PlayerNumber"/> <Binding Path="LastName"/> <Binding Path="FirstName"/> <Binding XPath="Position"/> </MultiBinding> </TextBlock.Text> </TextBlock> </ControlTemplate> </igEditors:XamComboEditor.Template> </igEditors:XamComboEditor>