So I have this problem, a textblock's text gets cut off, even though you can still scroll with scrollviewer to the end.
You can see the scrollviewer is still able to scroll to where the text should be.
Heres the XAML:
<Grid>
<ScrollViewer Height="Auto" VerticalScrollBarVisibility="Auto" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" >
<TextBlock x:Name="text" Padding="5" Margin="0" TextWrapping="Wrap" Text="" FontSize="24" TextTrimming="WordEllipsis" VerticalAlignment="Bottom" />
</ScrollViewer>
</Grid>
EDIT the whole pivot control code:
<controls:Pivot x:Name="pivot" Margin="0" Grid.Row="1" Title="title" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
<controls:PivotItem Header="Straipsnis">
<Grid>
<ScrollViewer Height="Auto" VerticalScrollBarVisibility="Auto" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" >
<Border BorderBrush="White" BorderThickness="1">
<TextBlock x:Name="text" Padding="5" TextWrapping="Wrap" Text="" FontSize="24"/>
</Border>
</ScrollViewer>
</Grid>
</controls:PivotItem>
<controls:PivotItem Header="Komentarai">
<Grid>
<ListBox x:Name="commentsListBox" ItemTemplate="{StaticResource CommentsList}" Height="Auto" Width="Auto" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch" FontSize="20"/>
<TextBlock x:Name="errorText" TextWrapping="Wrap" Text="Nėra komentarų..." FontSize="36" HorizontalAlignment="Left" Margin="10,0,0,0"/>
</Grid>
</controls:PivotItem>
</controls:Pivot>
Well, turns out the TextBlock has limits, 2048x2048 or something like that, after which the text just gets cut off.
So, I found this custom text control that bypasses this limitation :) Maybe someone will find it useful, I did.
Creating Scrollable TextBlock for WP7.
Download link
Related
my list view inside the split view is not scrolling.
XAML code of total page goes like below.
<SplitView ScrollViewer.IsVerticalRailEnabled="True" BorderBrush="White" BorderThickness="1" x:Name="windowssplit1" DisplayMode="Overlay" Margin="40,-95,0,-200" Width="340" HorizontalAlignment="Left" x:FieldModifier="Public" Grid.RowSpan="2">
<SplitView.Pane>
<!--<Grid Background="Gray" ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.IsVerticalScrollChainingEnabled="True">-->
<StackPanel Background="Gray" BorderBrush="White" BorderThickness="1" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.IsVerticalScrollChainingEnabled="True" Margin="0,49,0,-162">
<TextBlock Text="All Ages" Margin="20,10,0,10" Foreground="White" FontSize="20" />
<Border BorderThickness="0.4" BorderBrush="White" Margin="20,0,0,10" Width="280" HorizontalAlignment="Left"/>
<ListView x:Name="filterlist1" Margin="10,0,0,0" ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.IsVerticalRailEnabled="True" SelectionChanged="filterlist_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock FontSize="18" Margin="0,10,0,0" Foreground="White" Text="{Binding CategoryName}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<!--</Grid>-->
</StackPanel>
</SplitView.Pane>
</SplitView>
The List View present in the Bolded Code must Scroll how this can be done, Help me....
How to make the List scroll
i think you need to put your listview inside a scrolViwer !
I believe this has to do with the panel that the ListView is in. Set the ListView to have a 'fixed' MaxHeight so that it can know when to scroll.
<ListView x:Name="filterlist1" Margin="10,0,0,0"
ScrollViewer.VerticalScrollMode="Enabled"
ScrollViewer.IsVerticalRailEnabled="True"
SelectionChanged="filterlist_SelectionChanged"
MaxHeight="400">
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock FontSize="18" Margin="0,10,0,0" Foreground="White" Text="{Binding CategoryName}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
To make the ListView scrollable, we need give the ListView a explicit height or use a layout that can limit the height of ListView.
StackPanel is not suitable for this scenario as it won't limit the size of ListView. All items are showed in the ListView, but only these items in StackPanel can be seen.
We can use Grid instead of StackPanel and try with following code:
<SplitView x:Name="windowssplit1"
Grid.RowSpan="2"
Width="340"
HorizontalAlignment="Left"
BorderBrush="White"
BorderThickness="1"
DisplayMode="Overlay"
IsPaneOpen="True"
x:FieldModifier="Public">
<SplitView.Pane>
<Grid Background="Gray">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Margin="20,10,0,10"
FontSize="20"
Foreground="White"
Text="All Ages" />
<Border Width="280"
Margin="20,0,0,10"
HorizontalAlignment="Left"
BorderBrush="White"
BorderThickness="0.4" />
<ListView x:Name="filterlist1"
Grid.Row="1"
Margin="10,0,0,0"
SelectionChanged="filterlist_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Margin="0,10,0,0"
FontSize="18"
Foreground="White"
Text="{Binding CategoryName}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</SplitView.Pane>
</SplitView>
Here I set two rows in Grid and put the ListView in the second row. Second row's Height is set to * so it can get the rest Height of the Grid. I also remove the Margin in SplitView to see the scroll bar clearly.
In my ContentDialog. On focus any element, type TextBox, the keyboard appear. When Keyboard appear, have a big margin above( so 20-30 px maybe). This space is the same height of the space allocated for Primary and Secondary Buttons. If have this margin, my content have a scrollbar and I do not want it. I have space sufficient to show all content of my dialog if remove this margin/padding of course.
This topic is related with: ContentDialog Windows 10 Mobile XAML - FullScreen - Padding
<StackPanel Orientation="Horizontal">
<TextBox x:Name="txtUser" IsSpellCheckEnabled="False"
Background="Black" Foreground="Red BorderBrush="Red" BorderThickness="1"
PlaceholderText="Digit your username"
GotFocus="txtUser_GotFocus" Style="{StaticResource TextBoxStyle}"
TextChanged="txtUser_TextChanged"
/>
<Button x:Name="MakeOff"
Height="32" BorderThickness="1"
HorizontalAlignment="Center"
Foreground="Red" Background="Black"
Style="{StaticResource ButtonStyle}"
Margin="0">
<HyperlinkButton
Height="32" BorderThickness="1"
HorizontalAlignment="Center"
Foreground="Red" Background="Black"
Margin="0"
NavigateUri="www.google.pt"
Style="{StaticResource HyperLinkButtonStyleMobile}"
Content="Register">
<HyperlinkButton.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</HyperlinkButton.ContentTemplate>
</HyperlinkButton>
<Button
Height="32" BorderThickness="1"
HorizontalAlignment="Center"
Foreground="Red" Background="Black"
Style="{StaticResource ButtonStyle}"
Margin="0">
<HyperlinkButton x:Name="btnRegisterTwo"
Height="32" BorderThickness="1"
HorizontalAlignment="Center"
Foreground="Red" Background="Black"
Margin="0"
NavigateUri="www.google.pt"
Style="{StaticResource HyperLinkButtonStyleMobile}"
Content="Register">
<HyperlinkButton.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</HyperlinkButton.ContentTemplate>
</HyperlinkButton>
<Button x:Name="MakeOffThree"
Height="32" BorderThickness="1"
HorizontalAlignment="Center"
Foreground="Red" Background="Black"
Style="{StaticResource ButtonStyle}"
Margin="0">
</StackPanel>
</Grid>
Someone help to remove this?
Thanks
Interestingly, the ContentScrollViewer inside the style is given a fixed height during run-time, and a hack is to remove this x:Name from the ScrollViewer.
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" ZoomMode="Disabled" Margin="{ThemeResource ContentDialogContentScrollViewerMargin}" IsTabStop="False">
Also, you will need to add the RowDefinitions back to the root panel LayoutRoot in the style.
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
Use GroupBox, fill content. The same content sometimes stretches the GroupBox, sometimes not, and can not be seen completely. Why?
<GroupBox>
<GroupBox.Header>
<TextBlock Text="{Binding Caption}"
Foreground="#FF00A3E9"
FontSize="12"/>
</GroupBox.Header>
<GroupBox.Content>
<StackPanel HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Orientation="Vertical"
Margin="0,-10,0,0">
<Grid ... />
<FlowDocumentScrollViewer VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalScrollBarVisibility="Disabled"
IsSelectionEnabled="False"
Background="Blue"
Margin="0,0,0,-7"
Document="{Binding PartData}" />
<Grid ... />
</StackPanel>
</GroupBox.Content>
</GroupBox>
I have a ListBox in my WPF application where i am generating my ListBox items using a Datatemplate so in my Datatemplate i have some textboxes where i want taborder for Textboxes, How to achieve this i tried many ways but of no use.
Below is my XAML code :-
<DataTemplate x:Key="DataTemplate1" >
<Grid Height="100" Width="1255" Background="#FFDA4F4F" KeyboardNavigation.DirectionalNavigation="Continue" Margin="0,-8,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="62*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="MainGrid" KeyboardNavigation.TabNavigation="Continue">
<Canvas Background="#F5F5F5" Height="30" HorizontalAlignment="Left" Margin="213,31,0,0" x:Name="canvas45" VerticalAlignment="Top" Width="92">
<TextBox Canvas.Left="5" TabIndex="13" KeyboardNavigation.DirectionalNavigation="Continue" Text="{Binding Name}" Canvas.Top="5" Height="20" Tag="{Binding}" LostFocus="txbbox1LostFocus" x:Name="txbbox1" Width="82" PreviewTextInput="txbbbox1_PreviewTextInput" Background="Red" />
</Canvas>
<Canvas Height="30" HorizontalAlignment="Right" Margin="0,31,186,0" x:Name="canvas46" VerticalAlignment="Top" Width="92">
<TextBox Canvas.Top="5" TabIndex="14" Height="20" x:Name="txbbox2" LostFocus="txbbox2LostFocus" Text="{Binding txbbox2}" Tag="{Binding}" PreviewTextInput="txbbox2_PreviewTextInput" Width="82" Canvas.Left="5" Background="red" />
</Canvas>
</Grid>
</Grid>
</DataTemplate>
And this is my listbox which i'm binding with my datatemplate.
<ListBox x:Name="ListBox1" Background="Transparent" ItemsSource="{Binding}" HorizontalAlignment="Left" Height="Auto" Margin="53,430,0,0" VerticalAlignment="Top" Width="1241" ItemTemplate="{DynamicResource DataTemplate1}" BorderBrush="{x:Null}" Style="{DynamicResource JListBox1}" ItemContainerStyle="{StaticResource ListBox1_ItemContainerStyle}" Grid.ColumnSpan="2" SelectionChanged="ListBox1_SelectionChanged" />
Please Give me any suggestion how to do it, Thanks in Advance.
Instead of Setting TabIndex for each TextBox inside DataTemplate, try to Set TabNavigation to Cycle Mode, this will Move he cursor to next focusable field automatically.
Please follow this Link for More details
http://social.technet.microsoft.com/wiki/contents/articles/25152.wpf-how-to-tab-between-items-in-a-listbox.aspx
Here's my scrollviewerr to scroll a Grid. I'm testing in my phone and when I scroll the page up or down it back to the first position :( How can I solve this problem ?
<ScrollViewer Grid.Row="2"
Grid.RowSpan="3"
Grid.ColumnSpan="3" Margin="0"
VerticalAlignment="Top"
VerticalScrollBarVisibility="Visible"
Background="#CC000000"
HorizontalScrollBarVisibility="Disabled">
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" >
<Image Height="100" Width="100" Margin="10,10,346,560" Source="/HoroscopeImages/bachduong.png"/>
<TextBlock HorizontalAlignment="Left" Margin="10,115,0,0" TextWrapping="Wrap" Text="Bạch Dương" VerticalAlignment="Top" Height="36" Width="117"/>
<TextBlock HorizontalAlignment="Left" Margin="10,151,0,0" TextWrapping="Wrap" Text="(21/3 - 19/4" VerticalAlignment="Top" Height="36" Width="117"/>
<Image Height="100" Width="100" Margin="169,10,187,560" Source="/HoroscopeImages/kimnguu.png"/>
</Grid>
just make sure that the container in which ur scrollViewer lies has enough height or set it auto.