Click here to Skip to main content
15,063,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can anyone help me with the following.
XML
<ListBox ItemsSource="{Binding ToolsInfoList}" Margin="4,4,4,4" Background="{StaticResource GridBackground}" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Height="Auto" >
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="25"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Image  Grid.Row="0" Grid.Column="0" Source="{Binding IconSource}" Width="20" HorizontalAlignment="Left"/>
                        <TextBlock Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" >
                            <!--TODO:Temporary hard coded here, later move to resources-->
                            <Hyperlink Command="{Binding Path=DisplayToolDescriptionCommand}"  CommandParameter="{Binding }" Click="Hyperlink_OnClick">
                                 <Hyperlink.Resources>
                                    <Style TargetType="{x:Type Hyperlink}">
                                        <Setter Property="Foreground" Value="Black"></Setter>
                                        <Style.Triggers>
                                            <Trigger Property="Hyperlink.IsMouseOver" Value="True">
                                                <Setter Property="Hyperlink.Foreground" Value="#ffe8a6"></Setter>
                                            </Trigger>
                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
                                                <Setter Property="Foreground" Value="#ffe8a6" />
                                            </DataTrigger>                                        </Style.Triggers>
                                    </Style>
                                </Hyperlink.Resources>
                                 <!--TODO:Temporary hard coded here, later move to resources-->
                                <TextBlock Text="{Binding Name}" ></TextBlock>
                            </Hyperlink>
                        </TextBlock>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>


Datatrigger doesn't seem to work, what mistake i might be doing? Any help would be greatly appriciated...Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900