gpt4 book ai didi

xaml - Windows Phone : RelativeSource Mode=FindAncestor, AncestorType:无法解析符号 AncestorType

转载 作者:行者123 更新时间:2023-12-02 05:12:19 25 4
gpt4 key购买 nike

我正在制作一个列表框的模板。我喜欢仅在项目被选中时显示路径。

数据模板:

<DataTemplate x:Key="itplPlayerOfTheDay">
<Grid>
...
<Grid Width="50" Height="50" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,5,5,0">
<Path Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor , AncestorType={ListBoxItem}}, Path=IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}" Data="M32.5569,7.54591 C32.3883,13.1553 31.3485,16.9274z" Stretch="Uniform" Stroke="Black" >
</Path>
</Grid>
...
</Grid>
</DataTemplate>

显然我的 XAML 有问题。在设计器中是状态:无法解析符号祖先类型。

最佳答案

Windows Phone 不支持 AncestorType。

<DataTemplate x:Key="itplPlayerOfTheDay">
<Grid>
...
<Grid Width="50" Height="50" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,5,5,0">
<Path Visibility="{Binding ElementName=yourListBoxName, Path=SelectedItem, Converter={StaticResource BooleanToVisibilityConverter}}" Data="M32.5569,7.54591 C32.3883,13.1553 31.3485,16.9274z" Stretch="Uniform" Stroke="Black" >
</Path>
</Grid>
...
</Grid>
</DataTemplate>

在您的 BooleanToVisibilityConverter 中进行一些更改并完成!

关于xaml - Windows Phone : RelativeSource Mode=FindAncestor, AncestorType:无法解析符号 AncestorType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15233072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com