私は私のプロジェクトでWindow
と3 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
編集:
コードメインウィンドウの背後にある:
ucMain objUC = new ucMain(); //Declare Instance Of user Control
pageTransitionControl.ShowPage(objUC); // Show Instance of usercontrol in PageTransitionControl
ただ、私はUserControl
にあるボタンをクリックするとメインウィンドウにpageTransitionControl
の方法ShowPage
を実行したいです。
私はこのスレッドで私の質問に与えた答えを見てください:http://stackoverflow.com/questions/17059120/change-wpf-usercontrol-depending-on-a-property-of-a-treeviewitem –
それはそうです私の目標はあなた、さらに詳しい情報が追加されました@RomanoZumbé – Moslem7026