我怎样才能UIElement
忽略鼠标点击它并将其传递给它后面的控件?
我有50%的透明度UIElement
,涵盖了另一个元素.当我尝试单击背景元素时,前景半透明捕获鼠标单击UIElement
.
我刚刚开始使用Silverlight(2 RC0)并且似乎无法使用以下内容.我想创建一个简单的图像按钮用户控件.
我的用户控件的xaml如下:
<Button>
<Button.Template>
<ControlTemplate>
<Image Source="{TemplateBinding ImageSource}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" />
</ControlTemplate>
</Button.Template>
</Button>
Run Code Online (Sandbox Code Playgroud)
背后的代码如下:
public partial class ImageButtonUserControl : UserControl
{
public ImageButtonUserControl()
{
InitializeComponent();
}
public Image Source
{
get { return base.GetValue(SourceProperty) as Image; }
set { base.SetValue(SourceProperty, value); }
}
public static readonly DependencyProperty SourceProperty =
DependencyProperty.Register("SourceProperty", typeof(Image), typeof(ImageButtonUserControl),null);
}
Run Code Online (Sandbox Code Playgroud)
我希望能够动态创建ImageButtons并将它们填充到像WrapPanel这样的容器中:假设我们已经有一个名为"image"的图像:
ImageButtonUserControl imageButton = new ImageButtonUserControl();
imageButton.Source = image;
this.thumbnailStackPanel.Children.Add(imageButton);
Run Code Online (Sandbox Code Playgroud)
我需要做什么才能显示图像?我假设我需要对DataContext做一些事情,但我不太清楚什么或在哪里.
谢谢你的帮助
我有一个ListBox,显示可变高度的项目.我希望显示尽可能多的项目以适应可用空间,而不显示垂直滚动条.除了ListBox项目模板上的外科手术之外,有没有办法只显示不适合滚动的项目数量?
我是银光新手,现在学习基础知识.但我需要实现3D图像处理(拖放,编辑,旋转,调整大小,放大和缩小).请解释相应的代码示例,附件.请尽快.