Scrollable TextBox for Windows Phone

by Michael R. Albertin 2. January 2012 18:52

The TextBox control does not support scrolling in the non-edit mode.

If needed, there is the simple way:
http://forums.create.msdn.com/forums/p/69286/430208.aspx

Or you can create your own ControlTemplate and do something like this:

 

<ControlTemplate x:Key="ScrollableTextBox" TargetType="TextBox">
	<Grid Background="Transparent">
		<VisualStateManager.VisualStateGroups>
[...]
			<VisualStateGroup x:Name="FocusStates">
				<VisualState x:Name="Focused">
					<Storyboard>
[...]
						<ObjectAnimationUsingKeyFrames Storyboard.TargetName="EnabledBorderScroll" Storyboard.TargetProperty="VerticalScrollBarVisibility">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<ScrollBarVisibility>Disabled</ScrollBarVisibility>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
		<Border x:Name="EnabledBorder" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Margin="{StaticResource PhoneTouchTargetOverhang}">
			<ScrollViewer x:Name="EnabledBorderScroll" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
				<ContentControl x:Name="ContentElement" BorderThickness="0" Padding="{TemplateBinding Padding}" 
				HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}"/>
			</ScrollViewer>
		</Border>
		<Border x:Name="DisabledOrReadonlyBorder" Visibility="Collapsed" Background="Transparent" BorderBrush="{StaticResource PhoneDisabledBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{StaticResource PhoneTouchTargetOverhang}" >
			<TextBox x:Name="DisabledOrReadonlyContent" Text="{TemplateBinding Text}" Foreground="{StaticResource PhoneDisabledBrush}" Background="Transparent"
				SelectionBackground="{TemplateBinding SelectionBackground}" SelectionForeground="{TemplateBinding SelectionForeground}"
				TextWrapping="{TemplateBinding TextWrapping}" TextAlignment="{TemplateBinding TextAlignment}" IsReadOnly="True" Template="{StaticResource PhoneDisabledTextBoxTemplate}"
				FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" />
		</Border>
	</Grid>
</ControlTemplate>

Fixing Stuck Explorer Items

by Michael R. Albertin 16. September 2010 00:09
Fixing Stuck Explorer Items
During my testing, I figured out that Windows Explorer always seems to use the same exact filename to store the pinned/recent items: 1B4DD67F29CB1962.AUTOMATICDESTINATIONS-MS
So you can try this command, which will wipe out all the pinned and recent items for Windows Explorer only:

1. open %appdata%Microsoft\Windows\Recent\AutomaticDestinations

2. delete 1B4DD67F29CB1962.AUTOMATICDESTINATIONS-MS

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012 Syntax Error