【发布时间】:2011-07-14 14:19:16
【问题描述】:
我在 Silverlight 中有用户控件,它有一个按钮单击事件。当我将该用户控件添加到页面时,单击事件不会触发。我还有什么需要做的吗?
更新 用户控件本身会触发 click 事件。在页面内部时,它不会 页面
<navigation:Page x:Class="RadControlsSilverlightApp2.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
d:DesignWidth="640" d:DesignHeight="480"
Title="Page1 Page" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:my1="clr-namespace:TestSilverLight.UserControls;assembly=TestSilverLight">
<Grid x:Name="LayoutRoot">
<sdk:Label Height="28" HorizontalAlignment="Left" Margin="101,38,0,0" Name="label1" VerticalAlignment="Top" Width="120" Content="Test page" />
<my1:Top10Programs HorizontalAlignment="Left" Margin="335,71,0,0" Name="top10Programs1" VerticalAlignment="Top" />
</Grid>
用户控制
<UserControl x:Class="RadControlsSilverlightApp2.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" BorderThickness="1" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
【问题讨论】:
-
您能否提供更多详细信息(代码和/或 Xaml)。描述中没有说明用户控件如何实现 Button Click 事件。
标签: c# silverlight