WPF中的xaml引用不同项目间资源的问题

初始启动项目A有资源文件在app.xml加载为字典资源ResourceDictionary,其中有<Style x:key="buttonStyle".../>
在其它项目中想调用A中的字典资料,在xaml文件中写
<Button Style="{StaticResource buttonStyle}",设计器总提示找不到资源buttonStyle
怎么做才能正确引用呢
2楼:
我不太明白你的意思,我本来是做winform的,但有个项目要修改(WPF做的),其中整个程序集里有25个项目,在vs2008里,我们肯定有一个初始启动项,而在初始启动项里定义了一个资源(ResourceDictionary)这个资源文件会在app.xaml里加载成资源ResourceDictionary,其中资源文件里有一个button的样式设置,
在其它24个项目中的button都是用这个样式,但在Vs2008里查看设计器的时候直接用<Button Style="{StaticResource buttonStyle}",会提示找不到资源buttonStyle,
但运行起来是正确的,因为资源应该是静态的,运行起来后内存有了,这是找得到的,
但在转到设计器查看的时候就不行,我想问的是这个怎么在设计器中查看
注:那个样式不单是图片,还包括很多其它的颜色,大小,鼠标事件等

其中resources中的images的btn.png的properties的Build Action要设置为resource,然后使用
<Image Source="/resources;component/Images/btn.png"/>即可,当让要引用resources工程,意思是告诉wpf去resource的dll中找到btn.png这个组件。
温馨提示:内容为网友见解,仅供参考
第1个回答  推荐于2016-04-15
Thread t1 = null;
Thread t2 = null;
private void Form1_Load(object sender, EventArgs e)
{
t1 = new Thread(new ThreadStart(T1));
t1.Start();
t2 = new Thread(new ThreadStart(T2));
t2.Start();
}

private void button1_Click(object sender, EventArgs e)
{
if (t1.ThreadState == ThreadState.Aborted||t1.ThreadState==ThreadState.Stopped)
{
MessageBox.Show("线程1结束了");
t1.Abort();
}
if (t2.ThreadState == ThreadState.Aborted||t1.ThreadState==ThreadState.Stopped)
{
MessageBox.Show("线程2结束了");
t2.Abort();
}
}
private void T1()
{
MessageBox.Show("进程1");

}
private void T2()
{
MessageBox.Show("进程2");

}本回答被提问者采纳
第2个回答  2011-09-21
工作目录的路径?
相似回答