C# Editing text in binding textblock - c#

I have the following code:
<Image Grid.Row="0" Grid.Column="0" Source="/Images/check.png" Stretch="Fill"
Visibility="{Binding Checked}"/>
<TextBlock Grid.Row="0" Grid.Column="1" Tag="{Binding Uid}" Tap="RemindName_Tap"
HorizontalAlignment="Left" Text="{Binding Title}" TextWrapping="Wrap"
Padding="10,2,0,0" Foreground="White" Height="40" Margin="2,0,0,0" FontSize="24"
Width="365"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="Something here" Tag="{Binding Uid}"/>
How to edit text in second textblock?
There has to be "time" in the appropriate format. That I have in isolated storage, but I have to be properly formatted.

Related

TextBlock when run not displaying entire text

I am building a wpf application, where my text block text is fading out when the application is run.
Code is
<Grid>
<TextBlock Text="RSP Level" Width="78" Height="Auto" HorizontalAlignment="Left" Margin="54.2,3,0,398.6" Grid.Column="3"/>
<TextBlock Text="Hex" Width="60" Height="Auto" HorizontalAlignment="Left" Grid.Column="3" Margin="157.2,36,0,367.6" RenderTransformOrigin="0.993,0.976" Grid.ColumnSpan="2"/>
<TextBlock Text="Hex" Width="29" Height="20" TextWrapping="Wrap" HorizontalAlignment="Left" Grid.Column="3" Margin="31.2,35,0,368.6" RenderTransformOrigin="1.91,0.08" />
<TextBlock Text="Link" Width="29" Height="20" HorizontalAlignment="Left" Grid.Column="3" Margin="31.2,59,0,344.6" RenderTransformOrigin="0.993,0.976"/>
<TextBlock Text="Application" Width="61" Height="20" HorizontalAlignment="Left" Grid.Column="3" Margin="32.2,83,0,320.6" RenderTransformOrigin="0.993,0.976"/>
<TextBlock Text="Physical" Width="66" Height="Auto" HorizontalAlignment="Left" Grid.Column="3" Margin="158.2,61,0,342.6" RenderTransformOrigin="0.993,0.976" Grid.ColumnSpan="2"/>
<TextBlock Text="Link" Width="35" Height="Auto" HorizontalAlignment="Left" Grid.Column="3" Margin="158.2,85,0,318.6" RenderTransformOrigin="0.993,0.976"/>
<TextBlock Text="Application" Width="69" Height="Auto" HorizontalAlignment="Left" Grid.Column="3" Margin="157.2,108,0,295.6" RenderTransformOrigin="0.993,0.976" Grid.ColumnSpan="2"/>
</Grid>
This is not the right way to align contents. You can use StackPanel to place child elements below or beside each other. If you use Grid, define Rows and Columns. Using margins is not a proper way. Read more WPF about layouts here.

The name 'xxx' does not exist in the current context in WP7

this is my xaml code:
<TextBox x:Name="name_box_det" Text="{Binding Name}" Height="65" Margin="-12,-10,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FF40AA2F" HorizontalAlignment="Left" Width="467" SelectionBackground="#FF40AA2F" SelectionForeground="White" BorderBrush="#FF3FA92E" FontSize="18.667"/>
And this is C# code, to get text value:
var name_text_det = name_box_det.Text;
And I'm getting this exception:
The name 'name_box_det' does not exist in the current context
Xaml code is copied from another xaml, but I tried to write completely new and it does not help. Do you know where is error?
This is complete XAML code:
<Grid x:Name="LayoutRoot" Background="Transparent">
<Image Margin="0" Grid.Row="1" Source="devdesk.png" Stretch="Fill"/>
<StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="12,45,12,12"Orientation="Horizontal">
<ListBox x:Name="listBox1">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Height="27" Margin="0,0,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Record index:" VerticalAlignment="Top" Foreground="#FF6C6C6C"/>
<TextBox Text="{Binding Index}" x:Name="index_box_det" Height="65" Margin="-12,-10,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FF40AA2F" HorizontalAlignment="Left" Width="467" SelectionBackground="#FF40AA2F" SelectionForeground="White" BorderBrush="#FF3FA92E" FontSize="18.667"/>
<TextBlock Name="record_name" Height="27" Margin="0,-10,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Record name:" VerticalAlignment="Top" Foreground="#FF6C6C6C"/>
<TextBox x:Name="name_box_det" Text="{Binding Name}" Height="65" Margin="-12,-10,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FF40AA2F" HorizontalAlignment="Left" Width="467" SelectionBackground="#FF40AA2F" SelectionForeground="White" BorderBrush="#FF3FA92E" FontSize="18.667"/>
<TextBlock Height="27" Margin="0,-10,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Beneficiary:" VerticalAlignment="Top" Foreground="#FF6C6C6C"/>
<TextBox x:Name="beneficiary_box_det" Text="{Binding Beneficiary}" Height="65" Margin="-12,-10,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FF40AA2F" HorizontalAlignment="Left" Width="467" SelectionBackground="#FF40AA2F" SelectionForeground="White" BorderBrush="#FF3FA92E" FontSize="18.667"/>
<TextBlock Height="27" Margin="0,-10,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Price:" VerticalAlignment="Top" Foreground="#FF6C6C6C"/>
<TextBox x:Name="price_box_det" Height="65" Text="{Binding Price}" Margin="-12,-10,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FF40AA2F" HorizontalAlignment="Left" Width="467" SelectionBackground="#FF40AA2F" SelectionForeground="White" BorderBrush="#FF3FA92E" FontSize="18.667"/>
<TextBlock Margin="0,-10,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Deadline:" Foreground="#FF6C6C6C"/>
<TextBox x:Name="deadline_box_det" Text="{Binding Deadline}" Margin="-12,-10,0,0" Grid.Row="1" TextWrapping="Wrap" Foreground="#FF40AA2F" HorizontalAlignment="Left" Width="467" SelectionBackground="#FF40AA2F" SelectionForeground="White" BorderBrush="#FF3FA92E" FontSize="18.667"/>
<TextBlock Margin="0,-10,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Description:" Foreground="#FF6C6C6C" Height="27" VerticalAlignment="Bottom"/>
<TextBox x:Name="description_box_det" Text="{Binding Description}" Margin="-12,-10,0,0" Grid.Row="1" TextWrapping="Wrap" Foreground="#FF40AA2F" HorizontalAlignment="Left" Width="467" SelectionBackground="#FF40AA2F" SelectionForeground="White" BorderBrush="#FF3FA92E" FontSize="18.667" Height="285" VerticalAlignment="Bottom"/>
<Button Width="375" x:Name="edtbtn" Content="Edit this record" Click="edtbtn_Click" Height="88" Margin="-12,-10,0,0" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" BorderThickness="3" Foreground="#FF40AA2F" BorderBrush="#FF40AA2F" Background="{x:Null}"/>
<Button Width="100" x:Name="dltbtn" Click="dltbtn_Click" Height="88" Margin="-12,-98,0,0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" BorderThickness="3" Foreground="#FF40AA2F" BorderBrush="#FF40AA2F" Background="{x:Null}">
<StackPanel>
<Image Source="delete.png"/>
</StackPanel>
</Button>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>
name_box_det exists within the ItemTemplate of your ListBox. This is a different context to your page and hence the error. Because an instance of this TextBlock will exist for every item in the collection your there's no way to know which one you're referring to in the code behind.
I'm guessing you're doing this in the Delete button click event handler. As you haven't provided a full repro of what you're doing here's an example of how it may be done.
Assuming the UI contains:
<ListBox ItemsSource="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" />
<Button Content="delete" Grid.Column="1" Click="DeleteClicked"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
and the DataContext is something like:
this.DataContext = new[]
{
new SimpleViewModel { Name = "one" },
new SimpleViewModel { Name = "two" },
new SimpleViewModel { Name = "three" },
};
Then the click event handler can look like this:
private void DeleteClicked(object sender, RoutedEventArgs e)
{
MessageBox.Show(
"You're trying to delete " +
((sender as FrameworkElement).DataContext as SimpleViewModel).Name);
}

Listbox No Scrollbar

I have been up and down looking on the internet and many people seem to have this problem but its generally solved by changing the container to a grid, constraining the height etc. etc. I can't to seem to get this to work.
I have an observableCollection thats feeding into a DataTemplate. I can't for th life of me get the scrollbar working. Its there but not enabling. Thanks Scott
<TabItem Header="select a call" x:Name="TabActiveCalls" Style="{DynamicResource MyTabItem}" FontFamily="QuickType">
<Grid Margin="0.125,0.412,3.125,0" Height="471" HorizontalAlignment="Stretch">
<StackPanel Orientation="Horizontal" Width="839.14" HorizontalAlignment="Left" VerticalAlignment="Top" Height="56">
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="0,0,10,0" Width="741.14">
<StackPanel Height="28" Orientation="Horizontal" Width="733.14" HorizontalAlignment="Left">
<TextBlock x:Name="txtHistoryFound" TextWrapping="Wrap" Text="*" Foreground="#FFE20A0A" Visibility="Collapsed"/>
<TextBlock TextWrapping="Wrap" Text="filter by:" Margin="5,0,10,0" Foreground="#FF585AD4" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="call no" Margin="5,0,2,0" VerticalAlignment="Center" Foreground="#FF5E88DA"/>
<TextBox Template="{StaticResource TextBoxBaseControlTemplate}" x:Name="searchCallNo" TextChanged="searchCallNo_TextChanged" TextWrapping="Wrap" Width="67" Foreground="#FF1341B1" TextAlignment="Center" Margin="5,0,10,0" Height="22" VerticalAlignment="Center" />
<TextBlock TextWrapping="Wrap" Text="postcode" Margin="5,0,2,0" VerticalAlignment="Center" Foreground="#FF5E88DA"/>
<TextBox Template="{StaticResource TextBoxBaseControlTemplate}" x:Name="searchPostcode" TextWrapping="Wrap" Width="67" Foreground="#FF1341B1" TextAlignment="Center" Margin="5,0,10,0" Height="22" VerticalAlignment="Center"/>
<TextBlock Height="23" x:Name="txtSiteName" FontSize="16" Foreground="#FF0E7C0B" Width="409" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0" TextAlignment="Right" Text="Airedale International Ltd" />
</StackPanel>
<StackPanel Width="733.14" HorizontalAlignment="Left">
<Border Height="21" Margin="5,6,8,0" CornerRadius="3,3,0,0" BorderThickness="1" BorderBrush="#FFC0BABA">
<StackPanel Orientation="Horizontal" Background="#FFD0D5DE">
<TextBlock TextWrapping="Wrap" Text="CALL NO. / DATE DUE/ CUSTOMER" Margin="5,0,0,0" Foreground="{DynamicResource ListTitle}" FontSize="10.667" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="ENGINEER / ADDRESS" Margin="114,0,0,0" Foreground="{DynamicResource ListTitle}" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="REPORT" Margin="43,0,0,0" Foreground="{DynamicResource ListTitle}" RenderTransformOrigin="2.543,0.429" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="CALL" Margin="28,0,0,0" Foreground="{DynamicResource ListTitle}" RenderTransformOrigin="2.543,0.429" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="POSITION" Margin="43,0,0,0" Foreground="{DynamicResource ListTitle}" RenderTransformOrigin="2.543,0.429" VerticalAlignment="Center"/>
</StackPanel>
</Border>
</StackPanel>
</StackPanel>
<Image Height="56" Width="90" Source="/ComfortReportEng;component/Media/Images/comfort_group.png"/>
</StackPanel>
<ListBox ItemTemplate="{StaticResource DataTemplateReportList}" ItemsSource="{Binding Source={StaticResource cvsReportList}}"
Margin="5,56,8,0" MaxHeight="415" Height="415" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True"/>
</Grid>
</TabItem>
many thanks for getting back. Here is my DataTempate
<DataTemplate x:Key="DataTemplateReportList">
<Border Margin="0,2,0,0" BorderThickness="1" BorderBrush="#FFA19C9C" CornerRadius="3,3,0,0" Width="810.52" Height="50" >
<Grid Background="#FF737B89" Height="48" >
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Width="274" VerticalAlignment="Top" >
<StackPanel Height="23" Orientation="Horizontal" Margin="0">
<TextBlock TextWrapping="Wrap" Text="{Binding CallNo, Mode=TwoWay}" Foreground="#FF7DF51E" Margin="5,0,0,0" FontFamily="Verdana"/>
<TextBlock TextWrapping="Wrap" Text="{Binding DateDue, Mode=TwoWay, StringFormat=d}" Foreground="White" Margin="5,0,0,0" FontFamily="Verdana"/>
</StackPanel>
<StackPanel Height="23" Orientation="Horizontal">
<TextBlock TextWrapping="Wrap" Text="{Binding CompanyName, Mode=TwoWay}" Foreground="#FFFFEA00" Margin="5,0,0,0" FontFamily="Verdana"/>
</StackPanel>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Width="456" Orientation="Vertical" Height="46" Margin="274,1,0,1" VerticalAlignment="Top">
<StackPanel Height="23" Orientation="Horizontal">
<TextBlock TextWrapping="Wrap" Text="{Binding EngineerName, Mode=TwoWay}" Foreground="#FFCAE5C6" Margin="5,0,0,0" FontFamily="Verdana" Width="140"/>
<TextBlock TextWrapping="Wrap" Text="{Binding ReportStatus, Mode=TwoWay}" Foreground="#FF7DF51E" Margin="20,0,0,0" FontFamily="Verdana" Width="50"/>
<TextBlock TextWrapping="Wrap" Text="{Binding CallStatus, Mode=TwoWay}" Foreground="#FF7DF51E" Margin="20,0,0,0" FontFamily="Verdana" Width="50"/>
<TextBlock TextWrapping="Wrap" Text="{Binding Position, Mode=TwoWay}" Foreground="White" Margin="20,0,0,0" FontFamily="Verdana" Width="50"/>
</StackPanel>
<StackPanel Height="23" Orientation="Horizontal">
<TextBlock TextWrapping="Wrap" Text="{Binding Address, Mode=TwoWay}" Foreground="#FFFFEA00" Margin="5,0,0,0" FontFamily="Verdana" Width="483.12"/>
</StackPanel>
</StackPanel>
<Grid Width="56" HorizontalAlignment="Right" Margin="0,0,12.52,0" VerticalAlignment="Top">
<Image Name="imgInfo" Source="/ComfortReportEng;component/Media/Images/Info4.png" Margin="24,8,0,0" Cursor="Hand" MouseLeftButtonDown="imgInfo_MouseLeftButtonDown"/>
</Grid>
</Grid>
</Border>
</DataTemplate>
Must be a bug. I have the following only..
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ComfortReportEng.Views.EngineerReport.EngineerReport"
Title="Engineer Report" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded" SizeToContent="WidthAndHeight" >
<Window.Resources>
<CollectionViewSource x:Key="cvsReportList"/>
</Window.Resources>
<Grid Margin="0.125,0.412,3.125,0" Height="471">
<ListBox Margin="23,64,3,0" Width="834.14" ItemsSource="{Binding Source={StaticResource cvsReportList}}"
x:Name="lbReportList" SelectionChanged="lbReportList_SelectionChanged" Background="#FFEEEFE4" />
</Grid>
and code is
private void LoadReportList()
{
int number = 0;
List<int> myNumbers = new List<int>();
while (number < 80)
{
myNumbers.Add(number);
number += 1;
}
_cvsReportList = (CollectionViewSource)(this.FindResource("cvsReportList"));
_cvsReportList.Source = myNumbers;
}
This was copied over from another project. Completely confused. Please don't worry. It's not a logical problem. Please take this as a close call with no solution. Cheers again Scott
Just to give this completeness. I am not sure why this happens but here is it.
if (System.Environment.MachineName == "SCOTT-PC")
{
this.txtUserName.Text = "Scott Fisher";
this.txtPassword.Password = "palace";
//LoginOK();
}
else
Keyboard.Focus(this.txtUserName);
If I clear the comments on LoginOK procedure I will get no scrollbar. With it commented and I interact with the login screen then everything is fine. Finally here is the code for the LoginOK.
if (LoginService.CheckLogin(txtUserName.Text, txtPassword.Password.ToString()))
{
Helpers.User.ThisUser = this.txtUserName.Text;
EngineerReport.EngineerReport engReport = new EngineerReport.EngineerReport()
{
Owner = Window.GetWindow(this),
WindowStartupLocation =
System.Windows.WindowStartupLocation.
CenterOwner
};
this.Hide();
engReport.ShowDialog();
}
else
{
this.txtPassword.Password = "";
this.txtPassword.Focus();
}
Can you provide you DataTemplate as I believe I have just managed to mock up what you are trying to achieve and I have scrollbars visible and working form the start.
Here is the xaml that I used for the DataTemplate for the ListBox:
<ListBox DataContext="{StaticResource MusicData}" ItemsSource="{Binding XPath=Album}">
<ListBox.ItemTemplate>
<DataTemplate>
<ListBoxItem>
<StackPanel Orientation="Horizontal" >
<TextBlock>No.</TextBlock>
<TextBlock Text="{Binding XPath=No}"></TextBlock>
<TextBlock>Title</TextBlock>
<TextBlock Text="{Binding XPath=Title}"></TextBlock>
</StackPanel>
</ListBoxItem>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Hope this helps.
I also found a piece of code I used a while back and this might help. You can try setting the ItemsPanelTemplate:
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel>
<ScrollViewer VerticalScrollBarVisibility="Visible" />
</StackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
This will work with any items control as stated in this article:
http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemcontainerstyle.aspx
One final thing I can suggest is to create your own ControlTemplate for the ListBox Like so:
<ListBox.Template>
<ControlTemplate>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ListBox.Template>

TextTrimming not working

I have data binding to a listbox, and texttrimming property set to WordEllipsis, but it doesn't seem to work. The textblocks are showing text as if they do without the texttrimming property set. This is my xaml code. Please help.
<Grid>
<Grid.Resources>
<application:ViewModel x:Key="ViewModel"/>
</Grid.Resources>
<TextBlock Height="75" TextWrapping="Wrap" Text="Click on Settings to search for quotes (by author or by query)." VerticalAlignment="Top" TextAlignment="Center" FontSize="26.667"/>
<ListBox Margin="0,166,0,0" Name="lstQuote" DoubleTap="lstQuote_DoubleTap" Hold="lstQuote_Hold">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<es:RegularPolygon Fill="#FFF4F4F5" Height="90" InnerRadius="0.47211" PointCount="5" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" Width="84"/>
<StackPanel Orientation="Vertical" Margin="0,10,0,0">
<TextBlock Text="{Binding Author}" TextWrapping="Wrap" FontSize="24"/>
<TextBlock Text="{Binding Quote}" TextWrapping="NoWrap" FontSize="30" TextTrimming="WordEllipsis" Width="Auto" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="Random Quote" Height="79" Margin="48,83,44,0" VerticalAlignment="Top" x:Name="quotSearch" Click="quotSearch_Click" />
</Grid>
change TextBox Width properties to fixed width
<TextBlock Width="200" Height="75" TextWrapping="Wrap" Text="Click on Settings to search for quotes (by author or by query)." VerticalAlignment="Top" TextAlignment="Center" FontSize="26.667"/>

Vertical scroll in Pivot Page

It's a very stupid question :)
Which property sets vertical scroll?
Developing Windows Phone 7 app, I switched off this property, and I don't understand, how I did it :)
I use ComboBox, and when I create project, I can scroll text in ComboBox, but now I can't
You need to include all the items inside the Scrollviewer, as in pivot page, we can't make the content scroller without scroll viewer.
Here is the sample content.
<ScrollViewer HorizontalAlignment="Left" VerticalAlignment="Top" Height="647" Margin="0" Grid.Row="1">
<Grid x:Name="ContentPanel" Margin="0,0,0,24" Width="480" Height="1470" Grid.Row="1">
<Image x:Name="ImgProcess" Source="/GoogTaxi;component/images/loading2.jpg" Visibility="Collapsed" Stretch="None" Opacity="0.60" VerticalAlignment="Top" />
<TextBlock x:Name="tbkCompanyName" TextWrapping="Wrap" Text="Company Name" Margin="20,20,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtCompanyName" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,47,8,0"/>
<TextBlock x:Name="tbkAddress" TextWrapping="Wrap" Text="Address" Margin="20,120,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtAddress" AcceptsReturn="True" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,147,8,336" VerticalScrollBarVisibility="Auto" Height="131"/>
<TextBlock x:Name="tbkEmailId" TextWrapping="Wrap" Text="Email Id" Margin="20,279,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtEmailId" IsEnabled="False" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,306,8,0" d:LayoutOverrides="VerticalAlignment"/>
<TextBlock x:Name="tbkWebsite" TextWrapping="Wrap" Margin="20,379,0,0" VerticalAlignment="Top"><Run Text="Website"/><LineBreak/><Run/></TextBlock>
<TextBox x:Name="txtWebsite" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,406,8,0" d:LayoutOverrides="VerticalAlignment"/>
<TextBlock x:Name="tbkPhone" TextWrapping="Wrap" Text="Phone" Margin="20,479,0,0" VerticalAlignment="Top" d:LayoutOverrides="VerticalAlignment"/>
<TextBox x:Name="txtPhone" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,506,8,0"/>
<TextBlock x:Name="tbkCity" TextWrapping="Wrap" Margin="20,579,0,0" VerticalAlignment="Top" Text="City"/>
<TextBox x:Name="txtCity" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,606,8,0"/>
<TextBlock x:Name="tbkState" TextWrapping="Wrap" Text="State" Margin="20,676,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtState" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,704,8,0"/>
<TextBlock x:Name="tblCountry" TextWrapping="Wrap" Text="Country" Margin="20,780,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtCountry" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,806,8,0"/>
<TextBlock x:Name="tbkCompany_logo" Visibility="Collapsed" TextWrapping="Wrap" Text="Contact Person" Margin="20,0,0,42.602" VerticalAlignment="Top" d:IsHidden="True"/>
<TextBox x:Name="txtCompany_logo" Visibility="Collapsed" TextWrapping="Wrap" Margin="8,0,8,-29.305" VerticalAlignment="Top" d:IsHidden="True"/>
<TextBlock x:Name="tbkContactPerson" TextWrapping="Wrap" Text="Contact Person" Margin="20,879,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtContactPerson" TextWrapping="Wrap" Margin="8,908,8,0" VerticalAlignment="Top"/>
<TextBlock x:Name="tbkContactPhone" TextWrapping="Wrap" Text="Contact Person Phone" Margin="20,982,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtContactPhone" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,1005,8,0"/>
<TextBlock x:Name="tbkContactEmail" TextWrapping="Wrap" Text="Contact person Email ID" Margin="20,1079,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtContactEmail" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,1106,8,0"/>
<TextBlock x:Name="tbkMerchantId" TextWrapping="Wrap" Text="Google Merchant Id" Margin="20,1180,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtMerchantId" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,1209,8,0" IsEnabled="False" />
<TextBlock x:Name="tbkMerchantKey" TextWrapping="Wrap" Text="Google Merchant Key" Margin="20,1282,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtMerchantKey" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8,1310,8,0" IsEnabled="False" />
<Button x:Name="btnsave" Content="Save" Margin="33,1390,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Click="btnsave_Click" />
<Button x:Name="btnCancel" Content="Cancel" Margin="0,1390,33,0" VerticalAlignment="Top" HorizontalAlignment="Right" d:LayoutOverrides="HorizontalAlignment" Click="btnCancel_Click" />
</Grid>
</ScrollViewer>
There is no scroll functionality inside PivotItem. You should use ScrollViewer control to get it by your own.
In a pivot control, if the content is overflowing the vertical page then there should be default "vertical" scrolling available to you.
I had a similar control with "list box" bounded to property. Having the list box should automatically allow you to scroll.
Don't add a scrollviewer over the stack panel as it would make the scrolling enabled for each list item which you don't want.
<controls:PivotItem Header="all authors" Foreground="#FF0C388A">
<Grid>
<ListBox Margin="0,0,-12,0" ItemsSource="{Binding AllAuthorsList}" Foreground="#FF0C388A">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17" Width="432" Height="Auto">
<TextBlock Tap="TextBlockAuthor_Tap" Text="{Binding}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="#FF0C388A"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</controls:PivotItem>

Categories

Resources