标签: flipview

如何访问XAML DataTemplate中的控件?

我有这个翻转视图:

<FlipView x:Name="models_list" SelectionChanged="selectionChanged">
 <FlipView.ItemTemplate>
          <DataTemplate>
                <Grid x:Name="cv">
                        <Image x:Name="img1" Source = "{Binding ModelImage}" Stretch="Fill" Tag="{Binding ModelTag}"/>
                </Grid>
           </DataTemplate>
  </FlipView.ItemTemplate>
Run Code Online (Sandbox Code Playgroud)

我想找到当前所选索引的img1.在搜索它时,我在这里的一些帖子中找到了这个方法:

private DependencyObject FindChildControl<T>(DependencyObject control, string ctrlName)
    {
        int childNumber = VisualTreeHelper.GetChildrenCount(control);
        for (int i = 0; i < childNumber; i++)
        {
            DependencyObject child = VisualTreeHelper.GetChild(control, i);
            FrameworkElement fe = child as FrameworkElement;
            // Not a framework element or is null
            if (fe == null) return null;

            if (child is T && fe.Name== ctrlName)
            {
                // Found the control so …
Run Code Online (Sandbox Code Playgroud)

c# windows-8 winrt-xaml windows-store-apps flipview

26
推荐指数
2
解决办法
5万
查看次数

FlipView SelectionChanged事件仅在触摸操作完成时发生

来自文档:

注意当用户使用触摸交互翻转FlipView内容时,只有在触摸操作完成时才会发生SelectionChanged事件.这意味着当用户快速翻阅内容时,并不总是为每个项目生成单个SelectionChanged事件,因为操作仍在进行中.

有没有办法配置FlipView控件SelectionChanged为每次翻转启动?这种行为使得实现分页很有趣,因为如果用户足够快地翻转,可以在添加更多项目之前翻转到列表的末尾.

xaml flipview windows-8.1 windows-phone-8.1

9
推荐指数
1
解决办法
1621
查看次数

UWP - 使用翻转视图缩放图像(使用捏缩放和双击)

我需要显示图像(使用翻转视图控件)并允许用户缩放它们(使用捏缩放和双击)并拖动缩放图像.

我希望它与Flip View兼容(我的意思是它不应该使用拖动手势).

实现这一目标的最佳方法是什么?

c# xaml image flipview uwp

8
推荐指数
1
解决办法
5228
查看次数

Databound Flipview删除ViewModel.ItemAt(0)会导致翻转过渡

我正在制作一篇文章阅读应用程序(类似于Bing新闻应用程序),我正在使用a FlipView来浏览文章.该FlipView有它的的ItemsSource数据绑定到一个ObservableCollection<T>保存文章的内容.

我只想在ObservableCollection<T>内存和性能方面保留3篇文章,所以我订阅了这个flipView_SelectionChanged事件并删除了该项目Length - 1以便返回(右侧)和项目0前进(左侧)

我遇到的问题是,当我在0使用触摸手势翻转后删除项目时,动画会再次播放.

如何防止过渡动画再次播放?

这是一个例子.创建一个新的空白商店应用程序,并添加以下内容:

public sealed partial class MainPage : Page
{
    public ObservableCollection<int> Items { get; set; }

    private Random _random = new Random(123);

    public MainPage()
    {
        this.InitializeComponent();

        Items = new ObservableCollection<int>();

        Items.Add(1);
        Items.Add(1);
        Items.Add(1);

        flipview.ItemsSource = Items;
    }

    private void flipview_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        if (this.flipview.SelectedIndex == 0)
        {
            Items.Insert(0, 1);
            Items.RemoveAt(Items.Count - 1);
        }
        else if (this.flipview.SelectedIndex …
Run Code Online (Sandbox Code Playgroud)

c# winrt-xaml windows-store-apps flipview

5
推荐指数
1
解决办法
990
查看次数

带css3变换的Bootstrap翻转卡

我想用CSS3转换创建一个自举翻转卡.我确实从这个工作和基本的例子开始

但是我想修改它以获得固定高度卡和一些小的增强功能.特别是当用户点击我在右上角创建的图标时,我需要翻转卡片.

我已经修改了代码,你可以在这里看到.

问题是在正确翻转到背面后卡不会翻转到前面.

有人可以建议任何解决方案吗?

注意: 问题似乎与jquery代码有关.其实我有

$('div.flipControl').on('click', function () {
    $(this).closest('div[class="card"]').toggleClass('flipped');
});
Run Code Online (Sandbox Code Playgroud)

但如果我改变它

$('div.flipControl').on('click', function () {
    $(this).parent().parent().parent().toggleClass('flipped');
});
Run Code Online (Sandbox Code Playgroud)

一切都按预期工作.

css3 css-transforms twitter-bootstrap flipview

5
推荐指数
1
解决办法
1万
查看次数