我試圖將所有窗口設置爲在屏幕中心打開。 我所有的窗口都使用樣式文件:來自資源字典的窗口啓動位置
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Styles/Mystyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
所以我剛插入此屬性的資源字典:
<Style x:Key="windowStyle" TargetType="Window">
<Setter Property="WindowStartupLocation" Value="CenterScreen"/>
</Style>
但是,這是行不通的。我錯過了什麼嗎?
'WindowStartupLocation'是一個CLR屬性,在樣式設置器中只能指定依賴屬性。看到我的[答案](http://stackoverflow.com/questions/10596515/setting-windowstartuplocation-from-resourcedictionary-throws-xamlparseexception/21178555#21178555)。 – 2014-01-17 05:38:44