WPF DockPanel positioning

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
 
O

Olaf Rabbachin

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
 
T

tshad

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
 
O

Olaf Rabbachin

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
 
T

tshad

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
 
O

Olaf Rabbachin

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
 
Joined
Feb 5, 2011
Messages
2
Reaction score
0
DockPanel in WPF

Great Dear.
Thanks

<Window x:Class="MyApp.DummyAdminPanel"

Title="DummyAdminPanel" Height="300" Width="300">
<DockPanel LastChildFill="True" >


<Border DockPanel.Dock="Top"
CornerRadius="6"
Cursor="Hand"
BorderThickness="1"
BorderBrush="Gray"
Background="LightGray"
Padding="8"
Margin="0 0 0 8">
<TextBlock FontSize="14"
TextWrapping="Wrap">dddddddddddddddd</TextBlock>
</Border>



<Border DockPanel.Dock="Bottom"
CornerRadius="6"
Cursor="Hand"
BorderThickness="1"
BorderBrush="Gray"
Background="LightGray"
Padding="8"
Margin="0 0 0 8">
<TextBlock FontSize="14"
TextWrapping="Wrap">dddddddddddddddd</TextBlock>
</Border>


<Border DockPanel.Dock="Left"
CornerRadius="6"
Cursor="Hand"
BorderThickness="1"
BorderBrush="Gray"
Background="LightGray"
Padding="8"
Margin="0 0 0 8">
<TextBlock FontSize="14"
TextWrapping="Wrap">dddddddddddddddd</TextBlock>
</Border>
</DockPanel>
</Windows>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

WPF Rightbutton problem 1
WPF forms 2
Positioning CSS components 1
Silverlight 4 combobox 11
Silverlight 4 combobox 2
Silverlight grid col question 0
Use an ellipse shape as a window. 0
Media in my aspx 2

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top