Lightswitch添加背景图片
来源:互联网 发布:淘宝促销管理找不到 编辑:程序博客网 时间:2024/04/28 05:44
1,首先引用2个dll文件
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\LightSwitch\1.0\Client\Microsoft.LightSwitch.Client.Internal.dll
c:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Windows.Controls.Navigation.dll
2.在Application中添加如下代码即可
public partial class Application
{
Frame rootFrame = null;
partial void Application_Initialize()
{
Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke(() =>
{
rootFrame = ((Page)((ContentPresenter)System.Windows.Application.Current.RootVisual).Content).Content as Frame;
if (rootFrame != null)
rootFrame.Navigated += new System.Windows.Navigation.NavigatedEventHandler(rootFrame_Navigated);
});
}
void rootFrame_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
if (e.Content is LoginPage)
{
// prepare image, that is laying in the Resources folder as Embedded Resource
System.Windows.Media.Imaging.BitmapImage image = new System.Windows.Media.Imaging.BitmapImage();
image.SetSource(Assembly.GetExecutingAssembly().GetManifestResourceStream(this.GetType(), "Resources.bg.png"));
Image mylogo = new Image() { Source = image, Stretch = System.Windows.Media.Stretch.Uniform };
mylogo.SetValue(Grid.ColumnSpanProperty, 5);
mylogo.SetValue(Grid.RowSpanProperty, 7);
mylogo.Stretch = System.Windows.Media.Stretch.Fill;//拉伸
Grid grid = ((LoginPage)e.Content).Content as Grid;
grid.Children.Insert(0, mylogo); // not Add, for background
rootFrame.Navigated -= rootFrame_Navigated;
}
}
}
3.将图片添加到Resources中,发布后就可以看到效果了
- Lightswitch添加背景图片
- LightSwitch 添加Web导航
- 添加背景图片
- lightswitch datagrid 动态添加复选框的功能。
- lightswitch datagrid 动态添加复选框的功能。
- 给对话框添加背景图片
- treeview添加背景图片
- DataGridView 添加背景图片
- 窗体添加背景图片
- grub2 添加背景图片
- vc 添加背景图片
- Dlg添加背景图片
- 为对话框添加背景图片
- MFC对话框添加背景图片
- 单文档添加背景图片
- MFC对话框添加背景图片
- MFC对话框添加背景图片
- BCB RichEdit添加背景图片
- HTTP状态码(HTTP Status Code)
- C# - 邮件发送-代码详解-图解
- QT 多线程
- error C2787: 'IxxxxObject' no GUID has been associated with thisobject解决方法
- 简单封装JavaScript Date对象操作
- Lightswitch添加背景图片
- 清空购物车
- GDB backtrace bt 查看程序crash堆栈信息
- 调整Android的默认亮度
- c++连接mongo数据库。
- 数据库设计技巧
- sshd由于登录失败而无法启动--cygwin安装过程
- Android ApiDemo学习(五)Animation—— 3 CustomEvaluator
- poj 2318 TOYS--点在直线左侧还是右侧