Home Forums WPF controls Xceed DataGrid for WPF Binding to multiple columns in one cell

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #25954 |

    I want to conditionally format (via a BindingTrigger) a column based on the value of other columns in the current record.

    The problem is, I can’t figure what the binding expression would need to be to access columns from the underlying data table outside of the current column that is being rendered.

    I can retrieve the Xceed.Wpf.DataGrid.DataRow using the {RelativeSource FindAncestor}, but it seems like the only way to get the underlying System.Data.DataRow object is by GetItemFromContainer method – which is of no use in a data binding context.

    Seems like it should be possible, but looking through the docs and forum posts I haven’t been able to find an answer…

    Imported from legacy forums. Posted by Derek (had 2372 views)

    User (Old forums)
    Member
    Post count: 23064

    try something like
    <MultiDataTrigger>
    <MultiDataTrigger.Conditions>
    <Condition Binding=”{Binding RelativeSource={RelativeSource Self}, Path=DataContext.IsRed}” Value=”True” />
    <Condition Binding=”{Binding RelativeSource={RelativeSource Self}, Path=DataContext.IsGreen}” Value=”True” />
    </MultiDataTrigger.Conditions>
    <Setter Property=”Background” Value=”#FFFF00″ />
    </MultiDataTrigger>

    Imported from legacy forums. Posted by nat (had 479 views)

    User (Old forums)
    Member
    Post count: 23064

    Sorry… it should be like this for the binding expression

    {Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:Cell}}, Path=ParentRow.DataContext.IsRed}

    Imported from legacy forums. Posted by nat (had 3638 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.