XAML 코드

<UserControl x:Class="SilverlightApplication1.Page"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Width="400" Height="300" xmlns:SilverlightApplication1="clr-namespace:SilverlightApplication1" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Loaded="UserControl_Loaded">

<Grid x:Name="LayoutRoot" Background="White">

    <SilverlightApplication1:UserControl1 Margin="102,82,189,142" Name="new1"/>

    <SilverlightApplication1:UserControl1 HorizontalAlignment="Left" Margin="137,132.188,0,136.812" Width="40" d:LayoutOverrides="VerticalAlignment" Name="new2"/>

</Grid>

</UserControl>

 

Cs 코드

private void UserControl_Loaded(object sender, RoutedEventArgs e)

{

object obj = this.FindName("new1");

if (obj != null)

{

FrameworkElement f = obj as FrameworkElement;

f.Visibility = Visibility.Collapsed;

}

}

+ Recent posts