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
560
TextDecorations for individual cell using DataTemplate
posted

Hi,

for visualizing errors in my DataPresenter I use a DataTemplate:

<DataTemplate x:Key="{x:Static igDP:DataPresenterBase.DataErrorContentTemplateKey}" >
                    <Border x:Name="cellBorder" >
                        <Grid x:Name="panel">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Border x:Name="errorBorder" BorderThickness="1" BorderBrush="#FF5D696D" Grid.ColumnSpan="2" Visibility="Collapsed" SnapsToDevicePixels="True">
                                <Border x:Name="innerBorder" BorderThickness="1"  SnapsToDevicePixels="True"/>
                            </Border>
                            <Control x:Name="errorIcon"
                             Visibility="Collapsed"
                             Margin="4,0,0,0"
                             Style="{DynamicResource {x:Static igDP:DataPresenterBase.DataErrorIconStyleKey}}" />
                            <ContentPresenter x:Name="content" ContentTemplate="{x:Null}" Grid.Column="1" Margin="0,0,2,0" />
                        </Grid>
                    </Border>
                    <DataTemplate.Triggers>
                        <!--Value was set manually-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Path=Host.HasDataError}" Value="true" />
                                <Condition Binding="{Binding Path=Host.DataError,
                                                Converter={StaticResource validationErrorConverter},
                                                ConverterParameter={x:Static BL:SchemaValidator.ManualValue}}"
                                           Value="True" >
                                </Condition>
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="errorIcon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="cellBorder" Property="Background" Value="#FF8080ff" />                                                                            
                        </MultiDataTrigger>
                        <!--actual range is to low-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Path=Host.HasDataError}" Value="true" />
                                <Condition Binding="{Binding Path=Host.DataError}" Value="{x:Static BL:SchemaValidator.ActualRangeIsToLow}" />
                            </MultiDataTrigger.Conditions>                           
                            <Setter TargetName="errorIcon" Property="Visibility" Value="Collapsed" />                           
                            <Setter TargetName="cellBorder" Property="TextBlock.Foreground" Value="Red" />
                            <Setter TargetName="cellBorder" Property="TextBlock.TextAlignment" Value="Left" />
                            <Setter TargetName="cellBorder" Property="TextBlock.TextDecorations" Value="Underline" />
                        </MultiDataTrigger>                                                              
                    </DataTemplate.Triggers>
                </DataTemplate>

All stylings work as expected but the two rows in the DataTrigger

 

<Setter TargetName="cellBorder" Property="TextBlock.TextAlignment" Value="Left" />
<Setter TargetName="cellBorder" Property="TextBlock.TextDecorations" Value="Underline" />

 

have no effect on the cells.

 

How can I change Text styling (alignement/decorations) in this scenario for a single cell?

 

Parents Reply Children
No Data