WPF DockPanel positioning

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I was curious as to why in a DockPanel, if you set DockPanel.Dock="Left" -
it puts the object in the middle???

For example, I have 2 objects and one is .Dock="Top" and another that has
..Dock="Left". The 1st object is correctly at the top, but the next object
ends up in the middle.

<Window x:Class="FontViewer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Font Viewer" Height="480" Width="600">
<DockPanel>
<Border DockPanel.Dock="Top"
CornerRadius="6"
BorderThickness="1"
BorderBrush="Gray"
Background="LightGray"
Padding="8"
Margin="0 0 0 8">
<TextBlock FontSize="14"
TextWrapping="Wrap">
Select a font to view from the list below.
You can change the text by typing in the region at the
bottom
</TextBlock>
</Border>
<ListBox x:Name="FontList"
DockPanel.Dock="Left"
ItemsSource="{x:Static Fonts.SystemFontFamilies}"
Width="160" />

</DockPanel>
</Window>

If I add a TextBlock with a DockPanel.Dock="Bottom", it doesn't go to the
bottom but to the right of the ListBox????

<Window x:Class="FontViewer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Font Viewer" Height="480" Width="600">
<DockPanel>
<Border DockPanel.Dock="Top"
CornerRadius="6"
BorderThickness="1"
BorderBrush="Gray"
Background="LightGray"
Padding="8"
Margin="0 0 0 8">
<TextBlock FontSize="14"
TextWrapping="Wrap">
Select a font to view from the list below.
You can change the text by typing in the region at the
bottom
</TextBlock>
</Border>
<ListBox x:Name="FontList"
DockPanel.Dock="Left"
ItemsSource="{x:Static Fonts.SystemFontFamilies}"
Width="160" />
<TextBox x:Name="SampleText"
DockPanel.Dock="Bottom"
MinLines="4"
Margin="8 0"
TextWrapping="Wrap"
ToolTip="Type here to change the preview text.">

</TextBox>
</DockPanel>
</Window>

Thanks,

Tom
 
Hi tshad,
I was curious as to why in a DockPanel, if you set DockPanel.Dock="Left" -
it puts the object in the middle???

For example, I have 2 objects and one is .Dock="Top" and another that has
.Dock="Left". The 1st object is correctly at the top, but the next object
ends up in the middle.

that's because the DockPanel uses the last element to fill the window by
default. Adding a ...
LastChildFill="False"
.... to the DP's properties will disable that behaviour.

BTW - this (an ASP.Net NG) is not the right place for WPF questions. You
might want to go to the WPF-forums:
http://social.msdn.microsoft.com/Forums/en-US/wpf/threads

Cheers,
Olaf
 
Olaf Rabbachin said:
Hi tshad,


that's because the DockPanel uses the last element to fill the window by
default. Adding a ...
LastChildFill="False"
... to the DP's properties will disable that behaviour.

BTW - this (an ASP.Net NG) is not the right place for WPF questions. You
might want to go to the WPF-forums:
http://social.msdn.microsoft.com/Forums/en-US/wpf/threads

I couldn't find a newsgroup for WPF before.

I normally use msnew.microsoft.com but there doesn't seem to be a newsgroup
for wpf there.

They are normally microsoft.public.x and the closest I could find was
microsoft.public.dotnet.framework.aspnet.

Thanks,

Tom
 
Hi Tom,
I couldn't find a newsgroup for WPF before.

I normally use msnew.microsoft.com but there doesn't seem to be a newsgroup
for wpf there.

They are normally microsoft.public.x and the closest I could find was
microsoft.public.dotnet.framework.aspnet.

it seems that MS is sort of abandoning the NNTP-newsgroups. You won't find
any related to the "newer" technologies, hence you'll probably be bound to
use the forums instead. A shame, if you ask me.

Cheers,
Olaf
 
Olaf Rabbachin said:
Hi Tom,


it seems that MS is sort of abandoning the NNTP-newsgroups. You won't find
any related to the "newer" technologies, hence you'll probably be bound to
use the forums instead. A shame, if you ask me.

I agree.

I have a problem with the forums because I can't remember which ones I am on
and I usually access them from different locations. I usually use outlook
express to access them and I can go directly to msnew.microsoft.com to see
all my messages.

Thanks,

Tom
 
Hi Tom,
I have a problem with the forums because I can't remember which ones I am on
and I usually access them from different locations. I usually use outlook
express to access them and I can go directly to msnew.microsoft.com to see
all my messages.

FWIW - the forums support the so-called "NNTP Bridge". When logged in,
click the "My Settings" link on the top right. I haven't tried it out, but
maybe it's what you're after?

From the Forums FAQ:

--- 8< ---
The NNTP Bridge Client application allows a user to configure their NNTP
Reader to read and post to the forums. Users can install the client bridge
at the Online Forums Connection. To use the bridge users must first select
"Use NNTP Bridge" in the My Settings page. Note: at this time, there are no
plans to localize the support documentation for the tool but the tool
should work any locale forum. Users can visit the Online Forums Connection
for more information, bug status and to report issues or suggestions.
--- 8< ---

Cheers,
Olaf
 
Back
Top