Default value in WPF Binding

前端 未结 1 2048
伪装坚强ぢ
伪装坚强ぢ 2021-02-20 12:28

I\'ve bound the Height and Width of my window. Now, the window is so tiny in Visual Studio I can\'t work on it anymore. Setting default values to

相关标签:
1条回答
  • 2021-02-20 12:44

    See FallbackValue:

    <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>
    

    You might also be able to use MinWidth or MinHeight to address your small window issue.

    0 讨论(0)
提交回复
热议问题