문제

O.K., taking a hint from my previous post, in short how do I get the trigger to fire on an attached property?

After more trial (and much error), I think I know where the problem is, but not how to fix it. When using drag and drop onto the datagrid, the Trigger responsible for changing the background of the DataGridCell only fires on the first drop or load into an unused cell. Outside of removing the data from the cell, in which case the cell returns to the color of the row, any further use of the cell returns its background to the first cell specific color it had and the trigger no longer fires.

                <DataGridTextColumn.ElementStyle>
                    <Style TargetType="TextBlock">
                        <Setter Property="Foreground" Value="Blue" />
                        <Style.Triggers>
                            <DataTrigger Value="True">
                                <DataTrigger.Binding>
                                    <MultiBinding Converter="{StaticResource watchNameConverter}" ConverterParameter="1">
                                        <Binding RelativeSource="{RelativeSource Self}" Path="Text"></Binding>
                                        <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type DataGridCell}, AncestorLevel=1}"  Path="." />
                                        <Binding RelativeSource="{RelativeSource Self}" Path="."></Binding>
                                    </MultiBinding>
                                </DataTrigger.Binding>
                                <Setter Property="Background" Value="Purple"/>
                                <Setter Property="local:Scheduler.IsDirty" Value="True" />
                            </DataTrigger>

                            <Trigger Property="local:Scheduler.IsDirty" Value="true">
                                <Setter Property="Background">
                                    <Setter.Value>
                                        <MultiBinding Converter="{StaticResource colorTextConverter}" >
                                            <MultiBinding.Bindings>
                                                <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type DataGridCell}, AncestorLevel=1}"  Path="." />
                                            </MultiBinding.Bindings>
                                        </MultiBinding>
                                    </Setter.Value>
                                </Setter>

                            </Trigger>
                        </Style.Triggers>

                    </Style>
                </DataGridTextColumn.ElementStyle>
            </DataGridTextColumn>

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top