开发者

WPF: how to get remaining width in a StackPanel?

Given the code below:

<Window x:Class="Window3"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window3" Height="300" Width="300">
    <StackPanel Background="Yellow" Orientation="Horizontal">
        <TextBlock Background="Green" Text="some text" Width="200"/>
        <TextBox Width="{Binding ???}" />
        <TextBlock Background="Red" Text="some text" Width="50"/>
    </StackPanel>
</Window>

how do you bind second textbox's width as to fill the remaining space?

Please keep in mind I'm lo开发者_Go百科oking for a binding solution: I know how to do it using other layouts (like DockPanel or grid) but I'm not interested in that. Also, using ElementName is not of interest.

Thanks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜