Visually Located


Easily Create Parallax effects in Windows 10 apps

In October James Clarke tweeted some source code to add a parallax effect to UWP apps using the new Windows Composition framework. At the time the new SDK was not available so you could not get it working. Now that the new SDK is released we can start building apps using Windows Composition. The sample that James posted is nice and short, but it’s still code that you would need to repeat over and over. As I’ve mentioned before, I’m not a fan of repeating code. I am however a fan of custom controls and behaviors. This effect can easily be made into a behavior. In James’ sample he is parallaxing an image, but there is no reason it has to be an image. It could be any visual element. This allows you to use graphics or whatever you want as a background. public class ParallaxBehavior : Behavior<FrameworkElement>{ /// <summary> /// Gets or sets the element that will parallax while scrolling. /// </summary> public UIElement ParallaxContent { get { r... [More]

Creating a behavior or action to close a Flyout from a control within the Flyout

I recently started work on a new project and I’m trying hard to use “no code-behind”. This has been challenging for me as I tend to always put very view specific logic within the view itself. Things like navigation, starting storyboards or showing popups/flyouts. One thing I was trying to do recently was close a Flyout from a button within the flyout. My first approach was to try an EventTriggerBehavior for the Click event of the button along with the CallMethodAction. I tried two ways to call the Hide method on the flyout. 1: <Button x:Name="AddButton" Content="Add Item" > 2: <Button.Flyout> 3: <Flyout x:Name="AddItemFlyout" 4: Placement="Full"> 5: <StackPanel> 6: <TextBox x:Name="PlaceName" Header="Name"/> 7: <Grid> 8: <Grid.ColumnDefinitions> 9: <ColumnDefinition/> 10: <Col... [More]

Displaying HTML content in a TextBlock

So many apps are using third party services to display data. Some of these services may give detailed information in HTML format. Why would they give information in HTML? Simple it’s universal. Everyone can display HTML. All of the platforms have some form of a webview control to display HTML. I recently came across such a service that actually gave information in both plain text and HTML. The plain text did not offer the detail that the HTML content did. So I set out to create a way to display the HTML inside a TextBlock. You may ask why I did not use a Webview control and I’ll say with a smile “Because I didn’t want to”. I’ll be 100% honest here, I took some pointers from the HtmlAgilityPack. I should note that this is not intended to display an entire website. You can adjust it to work, but just don’t. To tackle this task I created a new Behavior that would adjust the text of a TextBlock when it was loaded. The Runtime Interactivity SDK does not include a base Behavior class like th... [More]

Creating a behavior to control the new StatusBar (SystemTray) in Windows Phone 8.1 XAML apps

Modify the StatusBar (SystemTray) in XAML in Windows Phone Runtime apps [More]

Using a behavior to control the ProgressIndicator in Windows Phone 8.1 XAML Apps

Modify the ProgressIndicator in XAML in Windows Phone Runtime apps [More]