MultiTrigger Condition to same binding

I am trying to achieve TextTrimming using ListBoxStyle_BASETB so that all text including IsSelected is TextTrimmed and then when text IsSelected the Property="Scroll" using AOTbMain_MARQUEE control starts, even though AOTbMain_MARQUEE starts ListBoxStyle_BASETB is still in effect so that ListBoxStyle_BASETB properties apply.

See the error below and complete code. I also include a video of what is happening.

Error:

Example Video:
Once the site allows me to post links I will update this.

Code:
`

<UserControl.Resources>
    <ResourceDictionary>
        <Style x:Key="ListBoxItemStyle" TargetType="ListBoxItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Grid>
                            <Image x:Name="SelectedGameOverlay" Source="{}pack://siteoforigin:,,,/Images/Selected Game Overlay.png" RenderOptions.BitmapScalingMode="HighQuality" Visibility="Hidden" />
                            <ContentPresenter x:Name="SelectedGameTextColour" HorizontalAlignment="Left" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter Property="Opacity" Value="1" />
                                <Setter TargetName="SelectedGameOverlay" Property="Visibility" Value="Visible" />
                                <Setter TargetName="SelectedGameTextColour" Property="TextElement.Foreground" Value="#FFFFFF" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ListBoxStyle" TargetType="plugin:AutoscrollListBox">
            <Setter Property="ItemContainerStyle" Value="{DynamicResource ListBoxItemStyle}" />
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderThickness" Value="0" />
        </Style>

        <Style x:Key="ListBoxStyle_BASE" TargetType="plugin:AutoscrollListBox" BasedOn="{StaticResource ListBoxStyle}">
            <Setter Property="ScrollMode" Value="Center" />
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemStyle}">
                        <Setter Property="Padding" Value="1" />
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ListBoxStyle_BASE_INDXFADER" TargetType="plugin:AutoscrollListBox" BasedOn="{StaticResource ListBoxStyle_BASE}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding IndexVisibility}" Value="Visible">
                    <Setter Property="Opacity" Value="0.1" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IndexVisibility}" Value="Hidden">
                    <Setter Property="Opacity" Value="1" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="ListBoxStyle_BASETB" TargetType="plugin:AutoscaleTextBlock">
            <Setter Property="TextTrimming" Value="CharacterEllipsis" />
            <Setter Property="TargetFontSize" Value="30" />
        </Style>

        <Style x:Key="AOTbMain_MARQUEE" TargetType="plugin:MarqueeTextBlock">
            <Setter Property="Scroll" Value="LeftTypewriter" />
            <Setter Property="ScrollDelayBeg" Value="0:0:5" />
            <Setter Property="ScrollDelayEnd" Value="0:0:3" />
            <Setter Property="ScrollSpeed" Value="0:0:5" />
        </Style>

        <Style x:Key="ListBoxItemStyleSearch" TargetType="ListBoxItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Grid>
                            <ContentPresenter x:Name="SelectedSearchTextColour" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter Property="Opacity" Value="1" />
                                <Setter TargetName="SelectedSearchTextColour" Property="TextElement.Foreground" Value="#FFFFFF" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ListBoxStyleSearch" TargetType="plugin:AutoscrollListBox">
            <Setter Property="ItemContainerStyle" Value="{DynamicResource ListBoxItemStyleSearch}" />
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="Background" Value="Transparent" />
        </Style>

        <Style x:Key="ListBoxStyle_INDX" TargetType="plugin:AutoscrollListBox" BasedOn="{StaticResource ListBoxStyleSearch}">
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemStyleSearch}">
                        <Setter Property="Padding" Value="1" />
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
    </ResourceDictionary>
</UserControl.Resources>

<Grid>
    <Viewbox HorizontalAlignment="Left">
        <plugin:AutoscrollListBox Name="Index" Style="{StaticResource ListBoxStyle_INDX}" Visibility="{Binding IndexVisibility}" />
    </Viewbox>

    <plugin:AutoscrollListBox Name="Items" Style="{StaticResource ListBoxStyle_BASE_INDXFADER}">
        <plugin:AutoscrollListBox.ItemTemplate>
            <DataTemplate>
                <DataTemplate.Resources>
                    <plugin:AutoscaleTextBlock x:Key="AutoscaleTextBlock" Text="{Binding Title}" Style="{StaticResource ListBoxStyle_BASETB}" x:Shared="False" />
                    <plugin:MarqueeTextBlock x:Key="MarqueeTextBlock" Text="{Binding Title}" Style="{StaticResource AOTbMain_MARQUEE}" x:Shared="False" />
                </DataTemplate.Resources>

                <ContentControl x:Name="ContentPresenter" />

                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}, Path=IsSelected}" Value="False">
                        <Setter TargetName="ContentPresenter" Property="Content" Value="{StaticResource AutoscaleTextBlock}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}, Path=IsSelected}" Value="True">
                        <Setter TargetName="ContentPresenter" Property="Content" Value="{StaticResource MarqueeTextBlock}"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
        </plugin:AutoscrollListBox.ItemTemplate>
    </plugin:AutoscrollListBox>
</Grid>

`

Sign In or Register to comment.