I am developing silverlight application. I am using itemscontrols in silverlight to diaply the UI according to requirement.
<ItemsControl x:Name="CertificationsAndLicensesItemsControl">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.Column="0" Width="500">
<TextBlock TextWrapping="Wrap" Foreground="Green" Text="{Binding Path=CertificationsAndLicensesTitle}" FontWeight="Bold" Margin="5"></TextBlock>
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" Text="Valid from:" HorizontalAlignment="Left" Margin="5"></TextBlock>
<TextBlock Text="{Binding Path=ValidFrom}" Margin="5" ></TextBlock>
<TextBlock Text="Until" Margin="5"></TextBlock>
<TextBlock Text="{Binding Until}" Margin="5"></TextBlock>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="5">
<Button x:Name="EditButton" Tag="{Binding Path=ID}" Content="Edit" Click="EditButton_Click"></Button>
<Button x:Name="DeleteButton" Tag="{Binding Path=ID}" Content="Delete" Click="DeleteButton_Click"></Button>
</StackPanel>
</Grid>
</Grid>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
The code behind is as follows
private void EditButton_Click(object sender, RoutedEventArgs e)
{
//int a = 10;
//CertificationsAndLicensesChildWindow obj = new CertificationsAndLicensesChildWindow();
//obj.Show();
ChildWindow1 obj1 = new ChildWindow1();
obj1.Show();
}
private void DeleteButton_Click(object sender, RoutedEventArgs e)
{
CertificationsAndLicensesChildWindow obj = new CertificationsAndLicensesChildWindow();
obj.Show();
}
The child window doesnt get displayed on button click. The whole UI gets disappear after I click the button. If I remove the following sentences
ChildWindow1 obj1 = new ChildWindow1();
obj1.Show();
Then at least breakpoint gets hit. If I keep the above sentenses as it is then breakpoint does not get hit. How shuld I display the child window on button click ? Can you please provide me any code or link through which I can resolve the above issue