【发布时间】:2013-07-08 06:21:16
【问题描述】:
我的项目中有Window 和三个UserControl,我有一个显示用户控件的控件
<Window x:Class="Hesabdar.winMain"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pageTransitions="clr-namespace:WpfPageTransitions;assembly=WpfPageTransitions"
Title="winMain" Height="500" Width="600" Loaded="Window_Loaded_1">
<Grid>
<pageTransitions:PageTransition Name="pageTransitionControl" TransitionType="SlideAndFade" />
</Grid>
</Window>
在UserControl 我有Button:
<UserControl x:Class="Hesabdar.ucMain"
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"
mc:Ignorable="d" Height="500" Width="600">
<Grid>
<Button Content="Manege" HorizontalAlignment="Left" Margin="391,163,0,0" Click="Button_Click_1"/>
</Grid>
</UserControl>
如何控制pageTransitionControl 从UserControl 导航pageTransitionControl 到其他userControl
编辑:
MainWindow 后面的代码:
ucMain objUC = new ucMain(); //Declare Instance Of user Control
pageTransitionControl.ShowPage(objUC); // Show Instance of usercontrol in PageTransitionControl
只是我想通过单击UserControl 中的按钮在mainWindow 中运行ShowPage 的pageTransitionControl 方法。
【问题讨论】:
-
看看我在这个线程中对我的问题给出的答案:stackoverflow.com/questions/17059120/…
-
看来我的目标和你不一样,更多信息已添加@Romano Zumbé
标签: c# wpf user-controls