关于Silverlight的一些问题

如何在代码中调用项目资源?

在写Uri时:

new Uri("/Silverlight;component/images/hand.png", UriKind.RelativeOrAbsolute)
其中,/Silverlight是项目名称,component/后面是相对项目根目录的资源路径。

如何屏蔽Silverlight自己的右键菜单?

在相应元素的MouseRightButtonDown中将e.Handled设为true即可:

private void LayoutRoot_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
    e.Handled = true;//屏蔽默认的右键菜单
}

如需自定义右键菜单则在这里添加相应事件。


文本框不能自动随着内容添加自动往下滚动?

在其TextChanged事件中,调用一下它的Select方法选择一下最后的字符。。。

private void tb_msg_TextChanged(object sender, TextChangedEventArgs e)
{
    tb_msg.Select(tb_msg.Text.Length - 1, 0);
}

就是这样。。。


输了你,赢了世界又如何...
原文地址:https://www.cnblogs.com/xwgli/p/2999836.html