I have the Main view:
<Window ...>
<WrapPanel Name="Container" Height="500" Width="1024" VerticalAlignment="Center">
<WrapPanel>
<local:RequestListView />
</WrapPanel>
</StackPanel>
</Window>
then this RequestListView is an User Control:
<UserControl x:Class="...RequestFormView">
<WrapPanel Name="Teste" Margin="20" Width="1000">
<StackPanel Name="LeftPanel" Width="500">
<WrapPanel>
<Label Content="Nome do Pedido"/>
<TextBox MinWidth="200" Text="{Binding Request.descRequest}"></TextBox>
</WrapPanel>
<StackPanel Name="LeftContainer">
</StackPanel>
</StackPanel>
<StackPanel Name="RigthPanel" Width="500">
<Label Content="Os campos marcados com * são obrigatórios."></Label>
<Button Width="75" Height="26" Content="Save"/>
<Button Width="75" Height="26" Content="Cancel"/>
</StackPanel>
<StackPanel Name="RightContainer">
</StackPanel>
</WrapPanel>
</UserControl>
Now on my RequestFormViewModel I want to access the "LeftContainer" and "RightContainer" panels. I'm trying:
StackPanel rightPanel = (StackPanel)Application.Current.MainWindow.FindName("RightContainer");~
But returns null. As far as I seen he can't "look" inside the control. How can I get those two panels?