English 中文(简体)
清单中未出现超文本链接的草场 s
原标题:Hyperlink Foreground styling in a listview not happening

我有一个问题促使我马上走下去,我只是想找到解决办法。

我有一份清单,清单项目模板就是一份数据表,它看起来:

<DataTemplate x:Key="template" >
  <TextBlock  Foreground="Green"  >
    <Hyperlink   Command="{Binding LoadReportCommand}"
              CommandParameter="{Binding DisplayName}"  >
            <TextBlock  Text="{Binding DisplayName}"  />
    </Hyperlink>       
   </TextBlock>
</DataTemplate>

超级链接的风格如下:

<Style x:Key="{x:Type Hyperlink}" TargetType="{x:Type Hyperlink}">
    <Setter Property="Foreground" Value="Green" />
    <Style.Triggers>
        <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding RelativeSource={RelativeSource   FindAncestor, AncestorType={x:Type ListViewItem}}, Path=IsSelected}" Value="True" />
            <Condition Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}, Path=Selector.IsSelectionActive}" Value="True" />
            </MultiDataTrigger.Conditions>
            <Setter Property="Foreground" Value="White"/>
        </MultiDataTrigger>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
        </Trigger>
    </Style.Triggers>
</Style>

当我使用它时,它不会像在选择该项目时预期的那样翻开地白。 如果指挥无法按预期得到授权,它的确会转而使用地面线。 如果我取消选择人的条件。 当选 在选择该项目时,它确实将原样的白色变成了,但如果选定该项目,它也是白色的。 我希望不积极选择是绿色的。 我也尝试过这番话,只是一个具有非常基本风格的县,似乎没有任何工作。

清单调查是在另一个用户控制中使用的用户控制。 数据模板属于第二用户控制的资源字典,受第一类用户控制类型数据模板的附属财产的约束,超链接的风格是单独的资源字典。

Any Help will be much appreciated

最佳回答

Hmm Selectedor.IsSlective is that false when the control hasn t got Focus? 如果可能的话,你会利用在清单中具有约束力的传闻和检查重点?

现在,我看一看——你对所附财产具有约束力——这方面有轻微的变化——尝试路径=(Selector.IsSelectionActive)}。

绿色联系——奇:

问题回答

暂无回答




相关问题
WPF convert 2d mouse click into 3d space

I have several geometry meshes in my Viewport3D, these have bounds of (w:1800, h:500, d:25). When a user clicks in the middle of the mesh, I want the Point3D of (900, 500, 25)... How can I achieve ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

WPF: writing smoke tests using ViewModels

I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to ...

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

How do WPF Markup Extensions raise compile errors?

Certain markup extensions raise compile errors. For example StaticExtension (x:Static) raises a compile error if the referenced class cannot be found. Anyone know the mechanism for this? Is it baked ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签