Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
830
Triggers in Controls
posted

Hi all,

I have a XamDataGrid and a Grid wich DataContext is Bound to the dataGrid´s ActiveDataItem. The Grid contains some controls with properties that depend on values of some fields.

For example, the Content of a Label should change depending on a value. I have code the Trigger:

<Label>

    <Label.Triggers>

        <Trigger Property="DataContext.Cells[MyField].Value" Value="True">

            <Setter Property="Content" Value="MyText"/>

        </Trigger>

    </Label.Triggers>

</Label>

When compiling I get a DataContext.Cells[MyField] Property Not Found Error.

Any Idea?

Thanks in advance.

Parents
No Data
Reply
  • 69686
    posted

    Hello,

    If you are binding to the ActiveDataItem, then you will not have cells. The ActiveDataItem is the underlying object and you can bind to its properties directly. Probably you want to bind to the ActiveRecord which exposes cells?

Children