Moh*_*yan 8 .net data-binding wpf default-value
我已经绑定的Height和Width我的窗口.现在,Visual Studio中的窗口非常小,我无法继续使用它.设置默认值Height,并Width会解决我的问题.有可能Binding吗?
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="Sth.MainWindow"
x:Name="Window"
Width="{Binding Path=WidthOfImage, Mode=TwoWay}"
Height="{Binding Path=HeightOfImage, Mode=TwoWay}"
>
...
</Window>
Run Code Online (Sandbox Code Playgroud)
我们可以在WPF中设置默认值Binding吗?怎么样?
ken*_*ner 16
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="Sth.MainWindow"
x:Name="Window"
Width="{Binding Path=WidthOfImage, Mode=TwoWay, FallbackValue=200}"
Height="{Binding Path=HeightOfImage, Mode=TwoWay, FallbackValue=150}"
>
...
</Window>
Run Code Online (Sandbox Code Playgroud)
您也可以使用MinWidth或MinHeight解决小窗口问题.
| 归档时间: |
|
| 查看次数: |
4228 次 |
| 最近记录: |