本文介绍了将标题设置为窗口。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很有趣,但我找不到我错的地方......

所以我有2个窗户。从第一个窗口开始,我在按钮点击事件中调用第二个:

It's funny, but I cann't find where I am wrong...
So I have 2 windows. From the first window I'm calling second on button click event:

var window = new WindowButtonClick("Graphic") {DataContext = new GraphicViewModel()};
window.ShowDialog();



第二个窗口是一个窗口,我加载不同的视图(像userControls一样创建)。这是一个例子,如何在Xaml中调用其中一个:


Second window is a window, where I load different views( created like userControls). Here is example, how do I call one of them in Xaml:

<Window x:Class="WindowButtonClick"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:graphic="clr-namespace:Windows.Graphic"
WindowStartupLocation="CenterScreen" >
<Window.Resources>
      <DataTemplate DataType="{x:Type graphic:GraphicViewModel}">
        <graphic:Graphic />
      </DataTemplate>
</Window.Resources>
<Grid>
    <ContentControl Content="{Binding}"/>
</Grid>



这里是我的WindowButtonClick的构造函数:


And here is a constructor of my WindowButtonClick:

InitializeComponent();
Title = Application.Current.Resources[title].ToString();



标题设置为资源的值,但我在创建的窗口上看不到标题..



任何想法有什么问题?


Title is set to a value from resource, but I cann't see Title on the created window..

Any ideas what's wrong?

推荐答案


这篇关于将标题设置为窗口。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 13:19