在Flipview中托管ActiveX控件

时间:2016-05-30 20:17:09

标签: c# wpf flipview

我已经尽力在Flipview中托管ActiveX控件,但无法达到预期的效果。我正在使用Windows 7和Flipview控件,如codeproject(http://www.codeproject.com/Articles/741026/WPF-FlipView)中所示。我实际上是在我的项目中嵌入了一个flash影片,并且在加载时应该加载新影片。

<UserControl x:Class="MTC.SIMVA.IC.Controls.WPFFlashControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:fla="clr-namespace:AxShockwaveFlashObjects;assembly=AxInterop.ShockwaveFlashObjects"
             mc:Ignorable="d" Loaded="UserControl_Loaded" >
    <DockPanel Width="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}">
        <WindowsFormsHost x:Name="flashMovie">
            <fla:AxShockwaveFlash x:Name="flashMovie2" />
        </WindowsFormsHost>
    </DockPanel>
</UserControl>

我还进行了自定义控制来包装AxShockwaveFlash控件。我的观点如下:

<dl:FlipView x:Name="flipView" ItemsSource="{Binding Flows}" SelectedIndex="0" SelectionChanged="flipView_SelectionChanged">
        <dl:FlipView.DataContext>
            <vm:SwipeWinViewModel />
        </dl:FlipView.DataContext>
        <dl:FlipView.ItemTemplate>
            <DataTemplate>
                <DockPanel x:Name="mainPanel" LastChildFill="True">

                    <DockPanel x:Name="topPanel" DockPanel.Dock="Top" HorizontalAlignment="Left" VerticalAlignment="Top" Background="#E4E4E4" Width="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DockPanel}}}">
                        <DockPanel LastChildFill="True" Height="80">
                            <TextBlock Text="{Binding Name}" FontFamily="Segoe UI" VerticalAlignment="Center" Block.TextAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap" FontWeight="Bold" FontSize="22" Margin="200,0,200,0" />
                        </DockPanel>
                    </DockPanel>

                    <DockPanel x:Name="animPanel" Background="LightBlue" Visibility="Collapsed" Width="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DockPanel}}}">
                        <uc:WPFFlashControl x:Name="flashControl" MovieSource="{Binding Source}"/>

                    </DockPanel>

                </DockPanel>
            </DataTemplate>
        </dl:FlipView.ItemTemplate>
    </dl:FlipView>

显示一个窗口但未显示任何内容。但是,当我使用没有FlipView的自定义控件时它工作正常,所以我认为FlipView控件存在问题。是否可以在FlipView控件的datatemplate中使用这种自定义控件?

0 个答案:

没有答案
相关问题