मैं बस बाईं ओर पाठ और बहती दाईं ओर एक पाठ बॉक्स चाहता हूं।
मदद बॉक्स को नीचे तक सभी तरह से विस्तारित करना चाहिए।
यदि आप बाहरी को बाहर निकालते हैं तो StackPanelयह बहुत अच्छा काम करता है।
लेकिन लेआउट के कारणों के लिए (मैं UserControls गतिशील रूप से सम्मिलित कर रहा हूं) मुझे रैपिंग की आवश्यकता है StackPanel।
मैं GroupBoxनीचे तक विस्तार करने के लिए कैसे प्राप्त StackPanelकर सकता हूं, जैसा कि आप देख सकते हैं कि मैंने कोशिश की है:
VerticalAlignment="Stretch"VerticalContentAlignment="Stretch"Height="Auto"
XAML:
<Window x:Class="TestDynamic033.Test3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test3" Height="300" Width="600">
<StackPanel
VerticalAlignment="Stretch"
Height="Auto">
<DockPanel
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Height="Auto"
Margin="10">
<GroupBox
DockPanel.Dock="Right"
Header="Help"
Width="100"
Background="Beige"
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch"
Height="Auto">
<TextBlock Text="This is the help that is available on the news screen." TextWrapping="Wrap" />
</GroupBox>
<StackPanel DockPanel.Dock="Left" Margin="10" Width="Auto" HorizontalAlignment="Stretch">
<TextBlock Text="Here is the news that should wrap around." TextWrapping="Wrap"/>
</StackPanel>
</DockPanel>
</StackPanel>
</Window>
उत्तर:
धन्यवाद मार्क, DockPanelबजाय StackPanelइसे मंजूरी दे दी का उपयोग कर। सामान्य तौर पर, मैं खुद DockPanelको WPF लेआउटिंग के लिए अधिक से अधिक उपयोग कर रहा हूं , यहां निश्चित XAML है:
<Window x:Class="TestDynamic033.Test3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test3" Height="300" Width="600" MinWidth="500" MinHeight="200">
<DockPanel
VerticalAlignment="Stretch"
Height="Auto">
<DockPanel
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Height="Auto"
MinWidth="400"
Margin="10">
<GroupBox
DockPanel.Dock="Right"
Header="Help"
Width="100"
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch"
Height="Auto">
<Border CornerRadius="3" Background="Beige">
<TextBlock Text="This is the help that is available on the news screen." TextWrapping="Wrap"
Padding="5"/>
</Border>
</GroupBox>
<StackPanel DockPanel.Dock="Left" Margin="10" Width="Auto" HorizontalAlignment="Stretch">
<TextBlock Text="Here is the news that should wrap around." TextWrapping="Wrap"/>
</StackPanel>
</DockPanel>
</DockPanel>
</Window>