I need to hide vertical scrollbar in LongListSelector. For this I use:
ScrollViewer.VerticalScrollBarVisibility="Hidden"
In ListBox it works well but in LongListSelector it doesn't work.
This is my LongListSelector code:
<Grid x:Name="ContentPanel"
Grid.Row="1"
Margin="12,0,12,0">
<toolkit:LongListSelector x:Name="TasksLongListSelector"
Margin="0,12,0,0"
Background="Transparent"
ScrollViewer.VerticalScrollBarVisibility="Hidden">
<toolkit:LongListSelector.GroupHeaderTemplate>
<DataTemplate>
<Border Width="431"
Height="53"
HorizontalAlignment="Left"
BorderThickness="2"
BorderBrush="White"
Margin="13,0,0,22">
<Grid HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Key, Converter={StaticResource LocalDateConverter}}"
FontSize="20"
FontWeight="Bold"
Foreground="White"
HorizontalAlignment="Left"
Padding="14,10,0,0" />
<Image Grid.Column="1"
Source="/Images/CalendarWhiteIcon.png"
Width="21"
Height="21"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="0,13,14,0" />
</Grid>
</Border>
</DataTemplate>
</toolkit:LongListSelector.GroupHeaderTemplate>
<toolkit:LongListSelector.ItemTemplate>
<DataTemplate>
<Button Background="White"
Width="455"
Height="105"
Margin="0,-12,0,12"
Tag="{Binding Id}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Click="Button_Click_1">
<Grid HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="24" />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="4"
Text="{Binding Name}"
FontSize="24"
Foreground="#400000" />
<Image Grid.Row="1"
Visibility="{Binding Project, Converter={StaticResource StringToVisibilityConverter}}"
Source="/Images/ProjectIcon.png"
Width="20"
Height="18"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="0,0,5,0" />
<TextBlock Grid.Row="1"
Grid.Column="1"
Visibility="{Binding Project, Converter={StaticResource StringToVisibilityConverter}}"
Text="{Binding Project, Converter={StaticResource ToUppercaseConverter}}"
FontSize="16"
Foreground="#666666"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="0,-2,9,0"
LineStackingStrategy="BlockLineHeight" />
<Image Grid.Row="1"
Grid.Column="2"
Visibility="{Binding Context, Converter={StaticResource StringToVisibilityConverter}}"
Source="/Images/ContextIcon.png"
Width="20"
Height="18"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="-3,1,1,0" />
<TextBlock Grid.Row="1"
Grid.Column="3"
Visibility="{Binding Context, Converter={StaticResource StringToVisibilityConverter}}"
Text="{Binding Context, Converter={StaticResource ToUppercaseConverter}}"
FontSize="16"
Foreground="#666666"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="0,-2,0,0"
LineStackingStrategy="BlockLineHeight" />
</Grid>
</Button>
</DataTemplate>
</toolkit:LongListSelector.ItemTemplate>
</toolkit:LongListSelector>
</Grid>
How can I hide vertical scrollbar in LongListSelector?
I found solution. To LongListSelector event Loaded add this code:
ScrollViewer sv = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(TasksLongListSelector, 0), 0) as ScrollViewer;
ScrollBar sb = ((FrameworkElement)VisualTreeHelper.GetChild(sv, 0)).FindName("VerticalScrollBar") as ScrollBar;
sb.Width = 0;
Related
I am working on windows universal app. I have issue regarding Print functionality in UWP.In this issue when i click on print button it prints the invoice page which is dynamic designed but print not covered whole page layout.
I am just putting my xaml code.
<Grid Background="White">
<Grid Name="gridpopup" Visibility="Visible" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="200"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="78"></RowDefinition>
<RowDefinition Height="150"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Margin="10,10,0,0" Grid.Row="0">
<TextBlock FontFamily="Arial Narrow" Text=" Print Order :" FontSize="20" Height="50" VerticalAlignment="Bottom" Foreground="#FFF05929" FontWeight="Bold" Margin="0,0,0,-10"/>
<TextBlock x:Name="invoice_inc_id" FontFamily="Arial Narrow" Text="{Binding id" FontSize="20" Height="40" VerticalAlignment="Top" Foreground="#FFF05929" FontWeight="Bold"/>
</StackPanel>
<StackPanel Grid.Row="1" BorderBrush="LightGray" BorderThickness="0,1,0,2">
<Image Name="logo" Height="70" Margin="220,10,220,0"/>
<StackPanel Orientation="Horizontal" Margin="10,35,0,0" Height="36">
<TextBlock FontFamily="Arial Narrow" Text=" Customer Name: " FontSize="18" Height="30" VerticalAlignment="Top" Foreground="Black" Margin="0,6,0,0"/>
<TextBlock Margin="15,7,0,0" Name="invoice_Customername" FontFamily="Arial Narrow" Text="{Binding customer_name}" FontSize="18" Height="24" VerticalAlignment="Top" Foreground="Black" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="12,10,-2,0" Height="36" HorizontalAlignment="Left" >
<TextBlock FontFamily="Arial Narrow" Text=" Phone/Email : " FontSize="18" Height="40" VerticalAlignment="Bottom" Foreground="Black" Margin="0,-4,0,0"/>
<TextBlock Margin="15,-5,0,0" Name="invoiceCustomeremail" FontFamily="Arial Narrow" Text="{Binding customer_email}" FontSize="18" Height="36" VerticalAlignment="Top" Foreground="Black" Width="210" />
</StackPanel>
</StackPanel>
<ListView Grid.Row="2" Name="lstinvoice" IsHitTestVisible="False" BorderBrush="LightGray" BorderThickness="0,0,0,1">
<ListView.Background>
<ImageBrush Stretch="Fill" ImageSource="Images/LoginImages/gradient_bg.png"/>
</ListView.Background>
<ListView.HeaderTemplate>
<DataTemplate>
<Grid Margin="0,5,0,8" Height="25">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400"></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Name" Foreground="#FF020202" FontSize="24" FontWeight="Bold" FontFamily="Raavi" SelectionHighlightColor="#FFE05022" VerticalAlignment="Center" Margin="25,0,2,3" Height="31"></TextBlock>
<TextBlock Grid.Column="1" Text="Quantity" Foreground="#FF040404" FontSize="24" FontWeight="Bold" FontFamily="Raavi" SelectionHighlightColor="#FFE05022" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,-5,-9"></TextBlock>
<TextBlock Grid.Column="2" Text="Price" Foreground="#FF080808" FontSize="24" FontWeight="Bold" FontFamily="Raavi" SelectionHighlightColor="#FFE05022" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,30,-9"></TextBlock>
</Grid>
</DataTemplate>
</ListView.HeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Grid.Row="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400"></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" FontFamily="Arial Narrow" Text="{Binding name}" FontSize="18" Height="40" VerticalAlignment="Center" Foreground="Black" Margin="10,0,0,0" Width="400" TextWrapping="Wrap"/>
<TextBlock Grid.Column="1" FontFamily="Arial Narrow" Text="{Binding ordered_qty}" FontSize="18" Height="40" VerticalAlignment="Center" HorizontalAlignment="Right" Foreground="Black" Margin="0,0,28,0" Width="auto"/>
<TextBlock Grid.Column="2" FontFamily="Arial Narrow" Text="{Binding unit_price}" FontSize="18" Height="40" VerticalAlignment="Center" HorizontalAlignment="Right" Foreground="Black" Margin="0,0,40,0" Width="auto"/>
</Grid>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Grid Grid.Row="3" Grid.RowSpan="2" Name="disscount_pnl_detail" Width="450" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="22"></RowDefinition>
<RowDefinition Height="22"></RowDefinition>
<RowDefinition Height="22"></RowDefinition>
<RowDefinition Height="22"></RowDefinition>
<RowDefinition Height="22"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"></ColumnDefinition>
<ColumnDefinition Width="150"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock FontFamily="Arial Narrow" Text="Sub Total : " Grid.Row="0" Grid.Column="0" FontSize="18" TextAlignment="Right" Foreground="Black" Height="22" />
<TextBlock Name="invoice_subtotal" Grid.Row="0" Grid.Column="1" Text="$0.00" HorizontalAlignment="Left" TextAlignment="Right" Foreground="#FFFF3400" FontSize="20" />
<TextBlock FontFamily="Arial Narrow" Text="Discount : " Grid.Column="0" Grid.Row="1" FontSize="18" TextAlignment="Right" Foreground="Black" Height="22" />
<TextBlock Text="$0.00" Name="invoice_discount" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" TextAlignment="Right" Foreground="#FFFF3400" FontSize="20" />
<TextBlock FontFamily="Arial Narrow" Text="Tax : " Grid.Row="2" Grid.Column="0" FontSize="18" TextAlignment="Right" Foreground="Black" Height="22" />
<TextBlock Text="$0.00" Name="invoice_tax" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right" Foreground="#FFFF3400" FontSize="20" />
<TextBlock FontFamily="Arial Narrow" Text="Shipping And Handling : " FontSize="18" Foreground="Black" TextAlignment="Right" Grid.Row="3" Grid.Column="0" />
<TextBlock Name="invoice_shippingcharge" Text="$0.00" HorizontalAlignment="Left" Foreground="#FFFF3400" TextAlignment="Right" FontSize="20" Grid.Row="3" Grid.Column="1" />
<TextBlock FontFamily="Arial Narrow" Text="Grand Total :" FontSize="22" Foreground="Black" TextAlignment="Right" FontWeight="Bold" Grid.Row="4" Grid.Column="0"/>
<TextBlock Name="invoice_grandtotal" Text="$0.00" HorizontalAlignment="Left" Foreground="#FFFF3400" FontSize="20" TextAlignment="Right" Grid.Row="4" Grid.Column="1" />
</Grid>
</Grid>
</Grid>
</Page>
Image:
To fix this issue, you can set FontFamily for those TextBlock. Once you add FontFamily in those TextBlock, they will be printed properly.
We can set FontFamily in those TextBlock like <TextBlock Name="invoice_subtotal" FontFamily="Arial Narrow" .../> one by one. Or as all TextBlocks are using "Arial Narrow" font, we can set it in a style that target all TextBlocks in this Grid like
<Grid Name="gridpopup" Background="White" Visibility="Visible">
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontFamily" Value="Arial Narrow" />
</Style>
</Grid.Resources>
...
</Grid>
I made a page in windows 8.1
and I need to put some item down in the Grid so the user can scroll it up and down without moving the BottomBar
but I could not do it
I looked for solutions but nothing work
here is my XAML code
I hope you could help me
<Page.BottomAppBar>
<CommandBar Height="82">
<AppBarButton Name="home"
Click="homeBarOnClick"
Label="Home"
Icon="Home"
ClickMode="Press"/>
<AppBarButton Name="area"
Click="areaBarOnClick"
Label="Area"
Icon="Calculator"
ClickMode="Press"/>
<AppBarButton Name="preimeter"
Click="preimeterBarOnClick"
Icon="Calculator"
Label="Preimeter"
ClickMode="Press"/>
<AppBarButton Name="size"
Click="sizeBarOnClick"
Icon="Calculator"
Label="Size"
ClickMode="Press"/>
</CommandBar>
</Page.BottomAppBar>
<Grid ScrollViewer.VerticalScrollBarVisibility="Auto" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="189*"/>
<ColumnDefinition Width="11*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="125*"/>
<RowDefinition Height="280*"/>
<RowDefinition Height="75*"/>
<RowDefinition Height="22*"/>
<RowDefinition Height="78*"/>
</Grid.RowDefinitions>
<!--Circle"-->
<Image x:Name="circle"
Tapped="circleOnTapped"
HorizontalAlignment="Left"
Height="119"
Margin="41,80,0,0"
VerticalAlignment="Top"
Width="159"
Source="images/circle.png"
RenderTransformOrigin="-2.528,-1.226" Grid.RowSpan="2"/>
<TextBlock x:Name="circleTextBlock"
HorizontalAlignment="Left"
Margin="73,74,0,0"
TextWrapping="Wrap"
Text="Circle"
VerticalAlignment="Top"
RenderTransformOrigin="0.5,0.5"
FontSize="25"
FontStyle="Normal"
Foreground="#FFF6901E"
Height="43" Width="80" Grid.Row="1"/>
<!--rectangle"-->
<Image x:Name="rectangle"
HorizontalAlignment="Left"
Tapped="rectangleOnTapped"
Height="110"
Margin="245,80,-4,0"
VerticalAlignment="Top"
Source="images/rectangle.png"
Width="159" Grid.RowSpan="2" Grid.ColumnSpan="2"/>
<TextBlock x:Name="rectangleTextBlock"
HorizontalAlignment="Left"
Margin="245,74,0,0"
TextWrapping="Wrap"
Text="Rectangle"
FontSize="25"
FontStyle="Normal"
Foreground="#FF1ABC9C"
Height="43" Width="120"
VerticalAlignment="Top" Grid.Row="1"/>
<!--rhombus"-->
<Image x:Name="rhombus"
HorizontalAlignment="Left"
Height="119"
Margin="41,153,0,0"
VerticalAlignment="Top"
Width="159"
Tapped="rhombosOnClick"
Source="images/rhombus.png" Grid.Row="1"
/>
<TextBlock x:Name="rhombusTextBlock"
HorizontalAlignment="Left"
Margin="55,277,0,0"
TextWrapping="Wrap"
Text="Rhombus"
FontSize="25"
FontStyle="Normal"
Foreground="#FF1ABC9C"
Height="43" Width="120"
VerticalAlignment="Top" Grid.RowSpan="2" Grid.Row="1"/>
<!--triangle"-->
<Image x:Name="triangle"
Source="images/triangle.png"
HorizontalAlignment="Left"
Height="110"
Tapped="traingleOnClick"
Margin="245,153,-4,0"
VerticalAlignment="Top"
Width="159" Grid.Row="1" Grid.ColumnSpan="2"/>
<TextBlock x:Name="traingleTextBlock"
HorizontalAlignment="Left"
Margin="260,277,0,0"
TextWrapping="Wrap"
Text="Traingle"
FontSize="25"
FontStyle="Normal"
Foreground="#FFC0392B"
Height="43"
Width="120"
VerticalAlignment="Top" Grid.RowSpan="2" Grid.Row="1" Grid.ColumnSpan="2"/>
<!--square"-->
<Image x:Name="square"
HorizontalAlignment="Left"
Height="110"
Margin="41,0,0,-65"
Source="images/square.png"
Grid.Row="4"
VerticalAlignment="Bottom"
Width="159"/>
</Grid>
Set the IsSticky = true;
Like so,
<Page.BottomAppBar>
<!-- StickyBar and start out as visible -->
<CommandBar Height="82" IsSticky="True" IsOpen="True">
<AppBarButton Name="home"
Label="Home"
Icon="Home"
ClickMode="Press"/>
</CommandBar>
</Page.BottomAppBar>
But you have to manually show and hide it now in the code-behind
BottomAppBar.IsOpen = true; // show the bar
BottomAppBar.IsOpen = false; // hide the bar
<ScrollViewer >
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<!-- .... inline elements -->
</Grid>
</ScrollViewer>
Try below code
<Grid x:Name="LayoutRoot">
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title Panel -->
<StackPanel Grid.Row="0" Margin="19,0,0,0">
<TextBlock x:Uid="Header" Text="MY APPLICATION" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
<TextBlock Text="{Binding Title}" Style="{ThemeResource HeaderTextBlockStyle}" Margin="0,-6.5,0,26.5" CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}" />
</StackPanel>
<Grid Grid.Row="1" x:Name="ContentRoot" Margin="19,9.5,19,0">
<ScrollViewer HorizontalScrollBarVisibility="Auto">
<!--
TODO: Content should be placed within the following grid
to show details for the current item
-->
</ScrollViewer>
</Grid>
</Grid>
<Page.BottomAppBar>
<CommandBar>
<AppBarButton x:Uid="AddAppBarButton" x:Name="AddAppBarButton" Label="add" Icon="Add" Click="AddAppBarButton_Click" />
<CommandBar.SecondaryCommands>
<AppBarButton x:Uid="SecondaryButton1" x:Name="SecondaryButton1" Label="secondary command 1" />
<AppBarButton x:Uid="SecondaryButton2" x:Name="SecondaryButton2" Label="secondary command 2" />
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
So I have a listbox with a template in which I bind an ObservableCollection of objects called "TotalDebits".
I have two way to delete the items:
One by one through a context menu
By range through a delete button and by fetching the checked objects.
This works:
private void Delete_Click(object sender, RoutedEventArgs e)
{
DeleteDebit((DirectDebit)(((MenuItem)sender).DataContext));
}
private void DeleteDebit(DirectDebit ddb)
{
TotalDebits.Remove(ddb);
}
private void delete_Click(object sender, EventArgs e)
{
DeleteDebitList();
}
private void DeleteDebitList()
{
try
{
foreach (var ddb in TotalDebits.ToList())
if (ddb.IsChecked)
TotalDebits.Remove(ddb);
}
catch
{
}
}
In both case, the items are properly deleted, the problem is, in the second case, the keyboard is showing up right after the items are deleted, for absolutely no reason.. Of course I can hide it right after by focusing on the list but it looks ugly and I wish I could find a way to prevent this issue from happening.
Edit:
You'll find hereunder the xaml of the page:
<controls:PivotItem Header="Direct Debit" >
<Grid>
<Grid.Resources>
<Storyboard x:Name="ListboxSizeIncrease">
<DoubleAnimation Storyboard.TargetName="DebitList" Storyboard.TargetProperty="Height"
From="475" To="380" Duration="0:0:.5"/>
</Storyboard>
<Storyboard x:Name="ListboxSizeDecrease">
<DoubleAnimation Storyboard.TargetName="DebitList" Storyboard.TargetProperty="Height"
From="380" To="475" Duration="0:0:.5"/>
</Storyboard>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ListBox Grid.Row="0" x:Name="DebitList" Height="475" Margin="10,5,10,0" Tap="ListBox_Tap" ItemsSource="{Binding TotalDebits}" VerticalAlignment="Top" ItemContainerStyle="{StaticResource CustomListBoxItem}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,2,0,2">
<Grid Margin="5,5,5,5" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60" />
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<CheckBox x:Name="CheckItem" Grid.Column="0" IsChecked="{Binding IsChecked}" Checked="CheckItem_Checked" Unchecked="CheckItem_Unchecked" />
<TextBlock x:Name="DescriptionBlock" FontSize="24" Grid.Column ="1" Text="{Binding Description}" HorizontalAlignment="Left" VerticalAlignment="Center">
</TextBlock>
<TextBlock FontSize="24" Grid.Column ="2" Text="{Binding Amount}" TextAlignment="Right" HorizontalAlignment="Right" VerticalAlignment="Center"/>
</Grid>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu Name="ContextMenu" IsZoomEnabled="False">
<toolkit:MenuItem Name="Edit" Header="Edit" Click="Edit_Click"/>
<toolkit:MenuItem Name="Delete" Header="Delete" Click="Delete_Click"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Border Margin="12,5,12,5" Grid.Row="1" Background="LightGray"/>
<Grid Grid.Row="1" Margin="14,8,14,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="TOTAL DIRECT DEBIT" FontSize="28" FontWeight="Bold" Foreground="DarkSlateGray"/>
<TextBlock Grid.Column="1" x:Name="TotalBlock" Text="{Binding TotalValue}" FontSize="28" FontWeight="Bold" Foreground="DarkSlateGray"/>
</Grid>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Margin="12,5,12,5" Background="LightGray">
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0">
<TextBlock Margin="10,0,0,0" Text="Description" FontSize="20" Foreground="DarkSlateGray"/>
<TextBox x:Name="DescriptionBox" FontSize="15" />
</StackPanel>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0">
<TextBlock Margin="0,0,0,0" Text="Amount" Foreground="DarkSlateGray"/>
<TextBox x:Name="AmountBox" FontSize="15" />
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Column="1">
<TextBlock Margin="10,0,0,0" Text="." Foreground="DarkSlateGray"/>
<TextBox x:Name="DecimalBox" Width="60" FontSize="15" MaxLength="2"/>
</StackPanel>
</Grid>
</Grid>
</Border>
</Grid>
</Grid>
</controls:PivotItem>
<controls:PanoramaItem Header="Aylık" Foreground="White">
<Grid x:Name="monthlyPanaromaGrid" >
<Grid.Resources>
<Style TargetType="ListBoxItem" x:Key="ListItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</Grid.Resources>
<ScrollViewer HorizontalAlignment="Stretch" Height="Auto" VerticalAlignment="Stretch">
<ListBox x:Name="monthlyItemListBox" ScrollViewer.VerticalScrollBarVisibility="Auto" >
<ListBox.ItemTemplate >
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<TextBlock Text="{Binding Id}" FontSize="24" />
<TextBlock Text=" " FontSize="24" />
<TextBlock Text="{Binding Name}" FontSize="24" />
<TextBlock Text=" " FontSize="24" />
<TextBlock Text="{Binding Surname}" FontSize="24" />
<TextBlock Text=" " FontSize="24" />
<TextBlock Text="{Binding Age}" FontSize="24" />
<TextBlock Text=" " FontSize="24" />
<TextBlock Text="{Binding Status}" FontSize="24" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
</Grid>
</controls:PanoramaItem>
I tried my list with 50 members but ı cant view the scrollviewer what might cause the problem? Thanks I see some answers here and I tried but not working(Changing height ... etc) thanks.
ListBox already has a ScrollViewer, and the two controls will fight over your manipulations.
Remove the outer ScrollViewer, or set ScrollViewer.VerticalScrollBarVisibility="Disabled" on your ListBox to disable scrolling.
And not sure if you're using those TextBlocks for Margin, but you should either set the Margin directly, or use ColumnDefinitions and a Grid.
<controls:PanoramaItem Header="Aylık" Foreground="White">
<Grid x:Name="monthlyPanaromaGrid" >
<Grid.Resources>
<Style TargetType="ListBoxItem" x:Key="ListItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</Grid.Resources>
<ListBox x:Name="monthlyItemListBox" HorizontalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Auto" >
<ListBox.ItemTemplate >
<DataTemplate>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Id}" Grid.Column="0" FontSize="24" />
<TextBlock Text="{Binding Name}" Grid.Column="1" FontSize="24" />
<TextBlock Text="{Binding Surname}" Grid.Column="2" FontSize="24" />
<TextBlock Text="{Binding Age}" Grid.Column="3" FontSize="24" />
<TextBlock Text="{Binding Status}" Grid.Column="4" FontSize="24" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</controls:PanoramaItem>
or
<controls:PanoramaItem Header="Aylık" Foreground="White">
<Grid x:Name="monthlyPanaromaGrid" >
<Grid.Resources>
<Style TargetType="ListBoxItem" x:Key="ListItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</Grid.Resources>
<ListBox x:Name="monthlyItemListBox" HorizontalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Auto" >
<ListBox.ItemTemplate >
<DataTemplate>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Id}" Grid.Column="0" FontSize="24" />
<TextBlock Text="{Binding Name}" Margin="48,0,0,0" Grid.Column="1" FontSize="24" />
<TextBlock Text="{Binding Surname}" Margin="48,0,0,0" Grid.Column="2" FontSize="24" />
<TextBlock Text="{Binding Age}" Margin="48,0,0,0" Grid.Column="3" FontSize="24" />
<TextBlock Text="{Binding Status}" Margin="48,0,0,0" Grid.Column="4" FontSize="24" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</controls:PanoramaItem>
I have added a grid control (I have added about 20 rows, each row contains 2 columns and each of them having text blocks as a child, and I am setting RowHeight as Auto) on top of scroll viewer. It's scrolling but not showing the full content of the grid. What could be the reason?
The issue will be that the framework can't determine the overall height to allocate to the control. Try setting the explicit height of the scrollviewer and/or the grid (if you can).
Update
Please post your exact code. (Or, at least code which recreates the issue.)
The following code is my understanding of what you've described but does not create the behaviour you are experiencing
<Grid x:Name="LayoutRoot" Background="Transparent">
<controls:Pivot Title="MY APPLICATION">
<controls:PivotItem Header="first">
<ScrollViewer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="A1" Grid.Column="0" Grid.Row="0" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="A2" Grid.Column="1" Grid.Row="0" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="B1" Grid.Column="0" Grid.Row="1" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="B2" Grid.Column="1" Grid.Row="1" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="C1" Grid.Column="0" Grid.Row="2" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="C2" Grid.Column="1" Grid.Row="2" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="D1" Grid.Column="0" Grid.Row="3" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="D2" Grid.Column="1" Grid.Row="3" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="E1" Grid.Column="0" Grid.Row="4" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="E2" Grid.Column="1" Grid.Row="4" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="F1" Grid.Column="0" Grid.Row="5" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="F2" Grid.Column="1" Grid.Row="5" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="G1" Grid.Column="0" Grid.Row="6" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="G2" Grid.Column="1" Grid.Row="6" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="H1" Grid.Column="0" Grid.Row="7" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="H2" Grid.Column="1" Grid.Row="7" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="I1" Grid.Column="0" Grid.Row="8" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="I2" Grid.Column="1" Grid.Row="8" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="J1" Grid.Column="0" Grid.Row="9" />
<TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="J2" Grid.Column="1" Grid.Row="9" />
</Grid>
</ScrollViewer>
</controls:PivotItem>
</controls:Pivot>
</Grid>