Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
lately i'm working on WPF UserControl,i'm kind first time using UserControl after WPF window. I have created WPF Application, it has Window called "MainWindow".MAinWindow have Button named 'Technology'. I have also created UserControl named 'TechnologyUserControl'.I want to show 'TechnologyUserControl' after clicking on button 'Technology'.

I have tried "TechnologyUserControl.Visibility = System.Windows.Visibility.Visible;"
where TechnologyUserControl is instance of UserControl...

Can anybody help me .. Thanks..
Posted
Updated 19-Mar-13 2:42am
v2
Comments
AmitGajjar 19-Mar-13 8:45am    
it will be helpful for us if you can post your code.
Member 9829394 19-Mar-13 8:51am    
Here is my UserControl Code

<usercontrol x:class="ProjectManagement.TechnologyUserControl"
="" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" height="300" width="425">
<grid width="421" removed="LightSkyBlue" visibility="Hidden">
<Label Height="28" HorizontalAlignment="Left" Margin="26,36,0,0" Name="label1" Style="{StaticResource lblStyle}" VerticalAlignment="Top" Width="120">Technology Name :</Label>
<textbox height="23" horizontalalignment="Left" margin="58,64,0,0" name="txtbxTechnologyName" verticalalignment="Top" width="120">
<Label Height="28" HorizontalAlignment="Left" Margin="26,98,0,0" Name="label2" Style="{StaticResource lblStyle}" VerticalAlignment="Top" Width="135">Technology Description :</Label>
<richtextbox margin="48,124,149,94" name="rchtxtTechnologyDescription">
<Button Height="23" Margin="146,0,173,56" Name="btnAddTechnology" Style="{StaticResource btnStyle}" VerticalAlignment="Bottom">Add Technology</Button>


1 solution

Hi,

Let me know if you are following below process,

1) Create instance of User control object.
2) Add control object in one of the parent existing control on the page(ex. inside some panel)

if you follow above two process then your control should display. you do not need to set visibility of your usercontrol. visibility is required only when you are hiding control.

Thanks
-Amit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900