I have this pivot control that will be binded with some data:
[EDIT]
Here is my full xaml, i tried to put the Grid.Row definitions and still not working.
<phone:PhoneApplicationPage x:Class="Horoscopo.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait"
Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<!--Data context is set to sample data above and LayoutRoot contains the root grid where all other page content is placed-->
<Grid x:Name="LayoutRoot">
<Grid.Background>
<ImageBrush Stretch="None"
ImageSource="/Assets/bg.jpg"
AlignmentY="Top"
AlignmentX="Center" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<phone:Pivot>
<phone:Pivot.Title>
<TextBlock Text="virgo"
Style="{StaticResource PhoneTextNormalStyle}"
Foreground="White"></TextBlock>
</phone:Pivot.Title>
<phone:PivotItem >
<phone:PivotItem.Header>
<TextBlock Text="hoje"
Margin="9,-7,0,0"
Style="{StaticResource PhoneTextTitle1Style}">
<TextBlock.Foreground>
<LinearGradientBrush EndPoint="0.5,1"
StartPoint="0.5,0">
<GradientStop Color="Black"
Offset="0" />
<GradientStop Color="#FFE9FF0B"
Offset="1" />
</LinearGradientBrush>
</TextBlock.Foreground>
</TextBlock>
</phone:PivotItem.Header>
<!--ContentPanel contains LongListSelector and LongListSelector ItemTemplate. Place additional content here-->
<ScrollViewer Grid.Row="1"
Margin="12,0,12,0">
<Grid x:Name="ContentPanel">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<phone:LongListSelector x:Name="MainLongListSelector"
Margin="0,0,-12,0"
ItemsSource="{Binding Items}"
SelectionChanged="MainLongListSelector_SelectionChanged">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17">
<TextBlock Text="{Binding LineOne}"
TextWrapping="Wrap"
Style="{StaticResource PhoneTextExtraLargeStyle}">
<TextBlock.Foreground>
<LinearGradientBrush EndPoint="0.5,1"
StartPoint="0.5,0">
<GradientStop Color="Black"
Offset="0" />
<GradientStop Color="#FFE9FF0B"
Offset="1" />
</LinearGradientBrush>
</TextBlock.Foreground>
</TextBlock>
<TextBlock x:Name="txtTexto"
Text="{Binding LineTwo}"
TextWrapping="Wrap"
Margin="12,-6,12,0"
Style="{StaticResource PhoneTextSubtleStyle}"
Foreground="White" />
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</Grid>
</ScrollViewer>
</phone:PivotItem>
<phone:PivotItem>
<phone:PivotItem.Header>
<TextBlock Text="favorito"
Margin="9,-7,0,0"
Style="{StaticResource PhoneTextTitle1Style}">
<TextBlock.Foreground>
<LinearGradientBrush EndPoint="0.5,1"
StartPoint="0.5,0">
<GradientStop Color="Black"
Offset="0" />
<GradientStop Color="#FFE9FF0B"
Offset="1" />
</LinearGradientBrush>
</TextBlock.Foreground>
</TextBlock>
</phone:PivotItem.Header>
<!--ContentPanel contains LongListSelector and LongListSelector ItemTemplate. Place additional content here-->
<ScrollViewer Grid.Row="1"
Margin="12,0,12,0">
<Grid x:Name="ContentFavoritoPanel">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<phone:LongListSelector x:Name="FavoritoListSelector"
Margin="0,0,-12,0"
ItemsSource="{Binding Favoritos}"
SelectionChanged="MainLongListSelector_SelectionChanged">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17">
<TextBlock Text="{Binding LineOne}"
TextWrapping="Wrap"
Style="{StaticResource PhoneTextExtraLargeStyle}">
<TextBlock.Foreground>
<LinearGradientBrush EndPoint="0.5,1"
StartPoint="0.5,0">
<GradientStop Color="Black"
Offset="0" />
<GradientStop Color="#FFE9FF0B"
Offset="1" />
</LinearGradientBrush>
</TextBlock.Foreground>
</TextBlock>
<TextBlock x:Name="txtTexto"
Text="{Binding LineTwo}"
TextWrapping="Wrap"
Margin="12,-6,12,0"
Style="{StaticResource PhoneTextSubtleStyle}"
Foreground="White" />
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</Grid>
</ScrollViewer>
</phone:PivotItem>
</phone:Pivot>
</Grid>
But the scrollviewer dont work, and i dont know why this happens.
I tried the suggestions of this Thread, but it didnt work.
Anybody can help me?
Thanks.
try to add the code below under your Grid ContentPanel :
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
Actually, your code works fine as I've tested.
If you need further help, you may need to paste your whole xaml.
I had a similar issue with a ScrollViewer inside a PivotItem. The problem was that the content (a Grid) inside the ScrollViewer was the same height as the PivotItem so there was effectively nothing for the ScrollViewer to scroll. I fixed the problem by making the PivotItem height smaller than the height of the content inside the ScrollViewer.
The problem is due to usage of multiple ScrollViewer; LongListSelector has default scrolling mechanism when items in it exceeds the size of the control, so we dont need to explicitly put a ScrollViewer over LongListSelector.
In your case, there will be two scrollviewers, one from LongListSelector and one which you put explicitly. So scrolling is not happening.
So, Just remove the ScrollViewer from all of your Pivot Items and set the Grid.Row property to the LongListSelector.
Related
Why my grid is not covering all the screen and how can i fix it? On the designer looks like it should be covering all the width of the screen, but actually leaves a big space on the rigth.
<Grid Background="GreenYellow">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="200"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
</Grid>
This code is only a snip, but even with childs the space its there on different sizes.
Edit 1:
Acoording to Luis C. answer i get the same result big empty space to the left:
I found a strange workaround to achieve what i want:
<Grid Background="Yellow">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="200"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<TextBlock Text="This is a very large text that only is used to strech all the childrens to the infinite. This is a very large text that only is used to strech all the childrens to the infinite. This is a very large text that only is used to strech all the childrens to the infinite. This is a very large text that only is used to strech all the childrens to the infinite. This is a very large text that only is used to strech all the childrens to the infinite" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Button Content="Black" Background="Black" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
<Button Grid.Row="1" Content="Black" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Button Grid.Row="2" Content="Black" Background="Blue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
The result is:
Still its a very strange way to workaround the problem.
Full Code
As you see, im using a SplitView on a GridView that loads Pages(like the one with the mentioned problem) on a Frame inside the SplitViewContent. Other Pages with TextBlock as childrens cover the whole screen as i want. The code for the SplitView is:
<Page
x:Class="MyProject.ViewModels.HomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyProject.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<RelativePanel>
<Button Name="HamburgerButton" FontFamily="Segoe MDL2 Assets" Content="" FontSize="36" Click="HamburgerButton_Click" Background="LightGray"/>
<!--<Button Name="BackButton" FontFamily="Segoe MDL2 Assets" Content="" FontSize="36" Visibility="Visible" Background="LightGray"/>-->
<CommandBar Name="Bar" RelativePanel.AlignRightWithPanel="True" ClosedDisplayMode="Compact" RelativePanel.RightOf="HamburgerButton" Visibility="Visible" Background="LightGray" IsOpen="False" IsSticky="True" >
<CommandBar.Content>
<TextBlock Name="BarTitle" Text="Title" FontSize="24" Margin="24,8,0,12" HorizontalAlignment="Center" VerticalAlignment="Center" />
</CommandBar.Content>
</CommandBar>
</RelativePanel>
<SplitView Name="MySplitView"
Grid.Row="1"
DisplayMode="Overlay"
OpenPaneLength="200"
CompactPaneLength="56"
HorizontalAlignment="Left">
<SplitView.Pane>
<ListBox SelectionMode="Single"
Name="IconsListBox"
SelectionChanged="IconsListBox_SelectionChanged">
<ListBoxItem Name="SymbolsListBoxItem">
<StackPanel Orientation="Horizontal">
<Image Source="x" Width="36" Height="36" HorizontalAlignment="Center" VerticalAlignment="Center"> </Image>
<TextBlock x:Uid="Symbols" Text="[Symbols]" FontSize="24" Margin="20,0,0,0" />
</StackPanel>
</ListBoxItem>
</ListBox>
</SplitView.Pane>
<SplitView.Content >
<Frame Name="FrameHolder"></Frame>
</SplitView.Content>
</SplitView>
<Frame Name="HomePageFrame" >
<!-- Frame not used by now-->
</Frame>
</Grid>
The full code page snippet is(with more children) and the result the same, big blank empty space to the right:
<Page
x:Class="MyProject.ViewModels.SymbolsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyProject.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:data="using:MyProject.Models"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<Style TargetType="ListView" x:Key="myListViewStyle">
<Setter Property="AllowDrop" Value="False" />
<Setter Property="CanReorderItems" Value="False" />
<Setter Property="Width" Value="36"/>
<Setter Property="Height" Value="140"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Padding" Value="0,4,0,0"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
<Setter Property="BorderBrush" Value="White" />
<Setter Property="BorderThickness" Value="1" />
</Style>
<Style TargetType="TextBlock" x:Key="SymbolViewer">
<Setter Property="FontFamily" Value="/Fonts/etc"/>
<Setter Property="FontSize" Value="30" />
<Setter Property="Padding" Value="8"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<LinearGradientBrush x:Key="GradBackground" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset=".5"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="ItemGradBackground" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="White" Offset=".5"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>
</Page.Resources>
<!-- Spinners -->
<StackPanel Background="AliceBlue" HorizontalAlignment="Stretch" Padding="0">
<StackPanel Background="{StaticResource GradBackground}" >
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
<ListView Name="Uno" ItemsSource="{x:Bind UnoItems}" Style="{StaticResource myListViewStyle}" BorderBrush="White"
BorderThickness="2" IsItemClickEnabled="True" ItemClick="Uno_ItemClick">
<ListView.ItemTemplate >
<DataTemplate x:DataType="data:Thingy">
<TextBlock Text="{x:Bind Symbol}" FontFamily="/Fonts/etc"></TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<!-- Not user interactive-->
<TextBlock Text="0" Width="36" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" ></TextBlock>
<!-- Spinner 2 -->
<ListView Name="Dos" ItemsSource="{x:Bind DosItems}" Style="{StaticResource myListViewStyle}"
IsItemClickEnabled="True" ItemClick="Dos_ItemClick">
<ListView.ItemTemplate >
<DataTemplate x:DataType="data:Thingy">
<TextBlock Text="{x:Bind Symbol}" ></TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ListView Name="Tres" ItemsSource="{x:Bind TresItems}" Style="{StaticResource myListViewStyle}">
<ListView.ItemTemplate >
<DataTemplate x:DataType="data:Thingy">
<TextBlock Text="{x:Bind Symbol}" ></TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ListView Name="Cuatro" ItemsSource="{x:Bind TresItems}" Style="{StaticResource myListViewStyle}">
<ListView.ItemTemplate >
<DataTemplate x:DataType="data:Thingy">
<TextBlock Text="{x:Bind Symbol}" ></TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ListView Name="Cinco" ItemsSource="{x:Bind DosItems}" Style="{StaticResource myListViewStyle}">
<ListView.ItemTemplate >
<DataTemplate x:DataType="data:Thingy">
<TextBlock Text="{x:Bind Symbol}" ></TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ListView Name="Seiss" ItemsSource="{x:Bind TresItems}" Style="{StaticResource myListViewStyle}">
<ListView.ItemTemplate >
<DataTemplate x:DataType="data:Thingy">
<TextBlock Text="{x:Bind Symbol}"></TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</StackPanel>
</StackPanel>
You just need to remove the "RowDefinition" without height and change the "Auto" Rows to "*".
Something like this:
<Grid Background="GreenYellow">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="200"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Content="Black" Background="Black" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Button Grid.Row="1" Content="Black" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Button Grid.Row="2" Content="Black" Background="Blue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
I'm trying to add a banner that remains fixed in the window to my page and I'm having a tough time.
This is what I am trying to achieve: I want a banner that floats at the top of the window (for an ad), then I want the rest of the content in a scrollable area. First item should be a textBlock, then a textBox, then a button.
This is the code I've got now and it looks right except for the scrolling. Help would be appreciated.
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App2"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Universal="using:Microsoft.AdMediator.Universal"
x:Class="App2.MainPage"
mc:Ignorable="d" RequestedTheme="Dark">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Grid.RowSpan="3">
<Universal:AdMediatorControl x:Name="AdMediatorName" Height="90" Id="AdMediator-Id" Margin="10,0"/>
<ScrollViewer x:Name="myScrollViewer" VerticalScrollMode="Enabled">
<StackPanel Grid.RowSpan="2">
<TextBlock x:Name ="outputConsole" FontSize="15" RenderTransformOrigin="0.5,0" TextWrapping="WrapWholeWords" Margin="0,0,10,0" FontFamily="Consolas" IsTextSelectionEnabled="True">
<TextBlock.RenderTransform>
<CompositeTransform/>
</TextBlock.RenderTransform>
<TextBlock.Projection>
<PlaneProjection/>
</TextBlock.Projection>
<Run/>
<LineBreak/>
<Run/>
</TextBlock>
<TextBox x:Name="inputConsole" FontSize="20" KeyUp="inputKeyUp" Margin="0,0,10,0" FontFamily="Consolas" IsTapEnabled="True" IsTextPredictionEnabled="True"/>
<Button x:Name="submitButton" Content="Submit" Click="submitButtonClick"/>
</StackPanel>
</ScrollViewer>
</StackPanel>
</Grid>
</Page>
I figured it out. I just needed to put it directly in the grid. Sorry, still learning XAML.
You just answered your question. You have to do something like this,
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal"><TextBlock x:Name ="outputConsole" FontSize="15" RenderTransformOrigin="0.5,0" TextWrapping="WrapWholeWords" Margin="0,0,10,0" FontFamily="Consolas" IsTextSelectionEnabled="True">
<TextBlock.RenderTransform>
<CompositeTransform/>
</TextBlock.RenderTransform>
<TextBlock.Projection>
<PlaneProjection/>
</TextBlock.Projection>
<Run/>
<LineBreak/>
<Run/>
</TextBlock>
<TextBox x:Name="inputConsole" FontSize="20" KeyUp="inputKeyUp" Margin="0,0,10,0" FontFamily="Consolas" IsTapEnabled="True" IsTextPredictionEnabled="True"/>
<Button x:Name="submitButton" Content="Submit" Click="submitButtonClick"/>
</StackPanel>
<ScrollViewer Grid.Row="1">
</ScrollViewer>
I'm working on a WP WinRT app that contains a page with a ListView that needs to scroll if it's content (binding) is longer than the screen. Now I want this app to be scalable across different screensizes, but right now the scrollviewer just falls of the page, and does not snap to the bottom of the screen.
XAML:
<Grid x:Name="LayoutRoot">
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition FromHorizontalOffset="100"/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title Panel -->
<StackPanel Grid.Row="0" Margin="19,0,0,0">
<TextBlock Text="TITLE" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,-0.167,0">
<TextBlock.Foreground>
<SolidColorBrush Color="{StaticResource LightForegroundColor}"/>
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="subtitle Margin="0,-6.5,0,26.5" Style="{ThemeResource HeaderTextBlockStyle}" CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}" FontSize="48">
<TextBlock.Foreground>
<SolidColorBrush Color="White"/>
</TextBlock.Foreground>
</TextBlock>
<TextBlock Margin="0,0,18.833,0" TextWrapping="Wrap" Text="This is a textblock with some random text." VerticalAlignment="Top" FontSize="14.667" Style="{StaticResource BaseTextBlockStyle}">
<TextBlock.Foreground>
<SolidColorBrush Color="{StaticResource DarkForegroundColor}"/>
</TextBlock.Foreground>
</TextBlock>
</StackPanel>
<ListView Grid.Row="1" Margin="0,10,0,0">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,11,0,0">
<TextBlock Style="{ThemeResource ListViewItemTextBlockStyle}" Text="Text"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
How can i set suitable size for listbox in Portrait Or Landscape views automatically ?
I don't have any problem in portrait view :
But in landscape view the listbox height is not okey , and listbox has not to be on recordpanel.
this is my xaml code :
<Grid x:Name="LayoutRoot">
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#E9E9E9" Offset="0"/>
<GradientStop Color="#FEFEFE" Offset="1"/>
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<MediaElement Name="SoundPlayer" AutoPlay="False" Volume="1" />
<StackPanel Grid.Row="0">
<StackPanel x:Name="StackPanelTopBar" >
</StackPanel>
<phone:Pivot Height="40" Background="#F9A11D" SelectionChanged="Pivot_SelectionChanged" >
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock FontSize="24" Text="{Binding}" Margin="0,-5,0,0"/>
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<phone:PivotItem Header="Alle"/>
<phone:PivotItem Header="A-E"/>
<phone:PivotItem Header="F-J"/>
<phone:PivotItem Header="K-O"/>
<phone:PivotItem Header="P-T"/>
<phone:PivotItem Header="U-Z"/>
</phone:Pivot>
<ListBox x:Name="ListBoxAlphabet" Height="Auto">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<controls:RoundButton Tag="{Binding File}" Content="{Binding Label}" FontSize="30" ButtonHeight="90" ButtonWidth="90"
HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Background="#FFD0D2D3" Foreground="White" PressedBrush="#F9A11D" BorderBrush="{StaticResource TransparentBrush}" Click="RoundButtonAlphabet_Click" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
<Grid x:Name="RecordPanel" Grid.Row="1" Margin="0,0,0,8">
<StackPanel VerticalAlignment="Bottom" Height="100">
<userControls:SoundRecorderPanel></userControls:SoundRecorderPanel>
</StackPanel>
</Grid>
</Grid>
I don't know if I understood right, but if you want that record panel is on the alphabets and alphabets-list is scrollable, then I can help.
The reason why alphabets-listbox is on the record panel, is that you put listbox to the stackpanel. And stackpanel is on the grid row, which height-property is auto. If you want that record panel is on to alphabets, you should define your row definition like this:
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
But then of course listbox doesn't fit to the screen and you have to scroll list if you want to see all alphabets.
Edit: You have to also change the stackpanel, where listbox and pivot is, to the grid like this:
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel x:Name="StackPanelTopBar" Grid.Row="0" >
</StackPanel>
<phone:Pivot Height="80" Background="#F9A11D" Grid.Row="1" SelectionChanged="Pivot_SelectionChanged">
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock FontSize="24" Text="{Binding}" Margin="0,-5,0,0"/>
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<phone:PivotItem Header="Alle"/>
<phone:PivotItem Header="A-E"/>
<phone:PivotItem Header="F-J"/>
<phone:PivotItem Header="K-O"/>
<phone:PivotItem Header="P-T"/>
<phone:PivotItem Header="U-Z"/>
</phone:Pivot>
<ListBox x:Name="ListBoxAlphabet" Height="Auto" Grid.Row="2">
// and so on...
Hopefully this helps!
I'm trying to create a reflection effect and it's working great except that I have to hard-code some values. This is my XAML:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition />
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1" VerticalAlignment="Center">
<UserControl x:Name="CurrentPresenter" />
<Border Width="500" Height="200" >
<Border.Background>
<VisualBrush Visual="{Binding ElementName=CurrentPresenter}" >
<VisualBrush.Transform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="-1" CenterX="500" CenterY="99" />
</TransformGroup>
</VisualBrush.Transform>
</VisualBrush>
</Border.Background>
<Border.OpacityMask>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,0.6">
<GradientStop Offset="-0.6" Color="Black"></GradientStop>
<GradientStop Offset="0.6" Color="Transparent"></GradientStop>
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
</StackPanel>
</Grid>
I've tried to replace Border's Width="500" and Height="200" by Width="{Binding ElementName=CurrentPresenter, Path=Width}" and Height="{Binding ElementName=CurrentPresenter, Path=Height}" but it doesn't seem to work.
Wha's wrong with this code?
UPDATE: If I set Width and Height here:
<UserControl x:Name="CurrentPresenter" Height="200" Width="500" />
It works as expected. However it doesn't work if I set those values in the UserControl XAML. Any ideas?
Rather than bind to the Height and Width properties of the UserControl, have you tried binding the Height and Width properties of the Border to the ActualHeight and ActualWidth properties of the UserControl?
<Border
Width="{Binding ElementName=CurrentPresenter, Path=ActualWidth}"
Height="{Binding ElementName=CurrentPresenter, Path=ActualHeight}" >
change path to ViewportWidth! its work for me