L
Lloyd Sheen
First thanks to those who responded and gave me ideas for books on WPF. I
read a couple and something's are clearer now.
I have a problem with layout which I have been banging my head for the last
couple of days. I have the following scenario:
Two usercontrols which both contain a third usercontrol.
The two main usercontrols are navigation controls and the third usercontrol
is a listview which encapsulates sorting etc.
The first navigator usercontrol has the following XAML (sorry for all the
code I have removed the UserControl.Resources to make it shorter):
<UserControl x:Class="CDsByDate"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:app="clr-namespace:Media_Player">
<DockPanel x:Name="SongsByDatePanel" DockPanel.Dock="Top" >
<Label DockPanel.Dock="Top" HorizontalAlignment="Center"
Height="auto">
Songs By Date
</Label>
<Grid DockPanel.Dock="Top" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width ="30"></ColumnDefinition>
<ColumnDefinition Width="10*"></ColumnDefinition>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition Width="30"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" VerticalAlignment="Center"
Style="{StaticResource NoButtonBorder}" x:Name="PreviousDay"
Margin="0,2,0,2"
Background="Transparent" IsEnabled="True"
ToolTip="Previous Day">
<StackPanel Orientation="Horizontal" >
<Image Source="..\Images\page-previous-48x48.png"
HorizontalAlignment="Right" Width="24" Height="24" IsEnabled="True"
ToolTip="Search for songs By ..." />
</StackPanel>
</Button>
<TextBlock Grid.Column="1" x:Name="CurrentDateTxt"
HorizontalAlignment="Center" VerticalAlignment="Center" >Current
Date</TextBlock>
<Button Grid.Column="2" VerticalAlignment="Center"
Style="{StaticResource NoButtonBorder}" x:Name="NextDay" Margin="0,2,0,2"
Background="Transparent" IsEnabled="True"
ToolTip="Previous Day">
<StackPanel Orientation="Horizontal" >
<Image Source="..\Images\page-next-48x48.png"
HorizontalAlignment="Right" Width="24" Height="24" IsEnabled="True"
ToolTip="Search for songs By ..." />
</StackPanel>
</Button>
<Button Grid.Column="3" VerticalAlignment="Center"
Style="{StaticResource NoButtonBorder}" x:Name="Today" Margin="0,2,0,2"
Background="Transparent" IsEnabled="True"
ToolTip="Today">
<StackPanel Orientation="Horizontal" >
<Image Source="..\Images\calendar-date-48x48.png"
HorizontalAlignment="Right" Width="24" Height="24" IsEnabled="True"
ToolTip="Search for songs By ..." />
</StackPanel>
</Button>
</Grid>
<app:FolderList DockPanel.Dock="Bottom"
x:Name="CDList"></app:FolderList>
</DockPanel>
</UserControl>
The second navigator has the following XAML:
<UserControl x:Class="ArtistNavigator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:app="clr-namespace:Media_Player">
<DockPanel x:Name="ArtistNavPanel" DockPanel.Dock="Top" >
<Label DockPanel.Dock="Top" HorizontalAlignment="Center"
Content="Artist Name" Height="auto"/>
<TextBox x:Name="ArtistSearch" DockPanel.Dock="Top" Height="auto"
Background="Transparent"/>
<app:FolderList DockPanel.Dock="Bottom"
x:Name="CDList"></app:FolderList>
<Popup x:Name="ArtistNamesPopup" AllowsTransparency="False"
IsOpen="False" >
<ListBox x:Name="ArtistNamesListBox"
Background="#FF4CCFD9"
Height="200"
SelectionChanged="ArtistNamesListBox_SelectionChanged"
/>
</Popup>
</DockPanel>
</UserControl>
When I look at the first UserControl "CDsByDate" it shows the FolderList
control with no horizontal size. I can tell this since I added a dummy set
of buttons at the bottom of the control to help in debugging the layout.
The second UserControl "ArtistNavigator" shows the FolderList correctly
filling the area between the "Grid" and the bottom of the page with the
FolderList.
I am totally at a loss in this endeavour. I have several other navigation
controls which use the FolderList with no problem. It is only the
ArtistNavigator which is incorrect. I have removed the Popup with no
difference in visual problem.
The only difference between controls is that the ArtistNavigator control has
no items added when the application first shows it.
Thanks,
Lloyd Sheen
read a couple and something's are clearer now.
I have a problem with layout which I have been banging my head for the last
couple of days. I have the following scenario:
Two usercontrols which both contain a third usercontrol.
The two main usercontrols are navigation controls and the third usercontrol
is a listview which encapsulates sorting etc.
The first navigator usercontrol has the following XAML (sorry for all the
code I have removed the UserControl.Resources to make it shorter):
<UserControl x:Class="CDsByDate"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:app="clr-namespace:Media_Player">
<DockPanel x:Name="SongsByDatePanel" DockPanel.Dock="Top" >
<Label DockPanel.Dock="Top" HorizontalAlignment="Center"
Height="auto">
Songs By Date
</Label>
<Grid DockPanel.Dock="Top" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width ="30"></ColumnDefinition>
<ColumnDefinition Width="10*"></ColumnDefinition>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition Width="30"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" VerticalAlignment="Center"
Style="{StaticResource NoButtonBorder}" x:Name="PreviousDay"
Margin="0,2,0,2"
Background="Transparent" IsEnabled="True"
ToolTip="Previous Day">
<StackPanel Orientation="Horizontal" >
<Image Source="..\Images\page-previous-48x48.png"
HorizontalAlignment="Right" Width="24" Height="24" IsEnabled="True"
ToolTip="Search for songs By ..." />
</StackPanel>
</Button>
<TextBlock Grid.Column="1" x:Name="CurrentDateTxt"
HorizontalAlignment="Center" VerticalAlignment="Center" >Current
Date</TextBlock>
<Button Grid.Column="2" VerticalAlignment="Center"
Style="{StaticResource NoButtonBorder}" x:Name="NextDay" Margin="0,2,0,2"
Background="Transparent" IsEnabled="True"
ToolTip="Previous Day">
<StackPanel Orientation="Horizontal" >
<Image Source="..\Images\page-next-48x48.png"
HorizontalAlignment="Right" Width="24" Height="24" IsEnabled="True"
ToolTip="Search for songs By ..." />
</StackPanel>
</Button>
<Button Grid.Column="3" VerticalAlignment="Center"
Style="{StaticResource NoButtonBorder}" x:Name="Today" Margin="0,2,0,2"
Background="Transparent" IsEnabled="True"
ToolTip="Today">
<StackPanel Orientation="Horizontal" >
<Image Source="..\Images\calendar-date-48x48.png"
HorizontalAlignment="Right" Width="24" Height="24" IsEnabled="True"
ToolTip="Search for songs By ..." />
</StackPanel>
</Button>
</Grid>
<app:FolderList DockPanel.Dock="Bottom"
x:Name="CDList"></app:FolderList>
</DockPanel>
</UserControl>
The second navigator has the following XAML:
<UserControl x:Class="ArtistNavigator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:app="clr-namespace:Media_Player">
<DockPanel x:Name="ArtistNavPanel" DockPanel.Dock="Top" >
<Label DockPanel.Dock="Top" HorizontalAlignment="Center"
Content="Artist Name" Height="auto"/>
<TextBox x:Name="ArtistSearch" DockPanel.Dock="Top" Height="auto"
Background="Transparent"/>
<app:FolderList DockPanel.Dock="Bottom"
x:Name="CDList"></app:FolderList>
<Popup x:Name="ArtistNamesPopup" AllowsTransparency="False"
IsOpen="False" >
<ListBox x:Name="ArtistNamesListBox"
Background="#FF4CCFD9"
Height="200"
SelectionChanged="ArtistNamesListBox_SelectionChanged"
/>
</Popup>
</DockPanel>
</UserControl>
When I look at the first UserControl "CDsByDate" it shows the FolderList
control with no horizontal size. I can tell this since I added a dummy set
of buttons at the bottom of the control to help in debugging the layout.
The second UserControl "ArtistNavigator" shows the FolderList correctly
filling the area between the "Grid" and the bottom of the page with the
FolderList.
I am totally at a loss in this endeavour. I have several other navigation
controls which use the FolderList with no problem. It is only the
ArtistNavigator which is incorrect. I have removed the Popup with no
difference in visual problem.
The only difference between controls is that the ArtistNavigator control has
no items added when the application first shows it.
Thanks,
Lloyd Sheen