0

我有以下 XAML:

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:WpfToolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="{x:Static prop:Resources.Window1}" 
Height="{Binding WindowHeight}"
MinHeight="{Binding WindowMinHeight}"
MinWidth="500">

WindowHeight正如预期的那样,火灾的吸气剂。

但是当我添加:

Width="750"

到 XAML .. :

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:WpfToolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="{x:Static prop:Resources.Window1}" 
Height="{Binding WindowHeight}"
MinHeight="{Binding WindowMinHeight}"
Width="750"
MinWidth="500">

.. getter forWindowHeight不会触发。

为什么是这样?

谢谢,乔

4

1 回答 1

4

尝试这个:

<Window x:Name="window" x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:WpfToolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="{x:Static prop:Resources.Window1}"
Height="300"
Width="{Binding Height, ElementName=window}">
于 2012-11-16T17:55:29.317 回答