Are Click, Tapped, and PointerPressed synonymous in WinRT-XAML?

Click is there for backwards compatibility, and is essentially the same as Tapped. Tapped is a “high level gesture” that will translate automatically to a click, tap, pen press, etc. and is what I would recommend to use. PointerPressed is not what you want. Here’s why: if I press and hold, the PointerPressed event will … Read more

Trigger element (XAML) is not supported in a UWP project

No, you don’t have Trigger support in UWP. A workaround is to use DataTriggerBehavior with a ChangePropertyAction to accomplish the exact same thing. xmlns:Interactivity=”using:Microsoft.Xaml.Interactivity” xmlns:Core=”using:Microsoft.Xaml.Interactions.Core” <Button x:Name=”MyButton” Width=”140″ Height=”80″ IsEnabled=”False”> <Image x:Name=”MyImage” Source=”Assets/xxx.jpg”> <Interactivity:Interaction.Behaviors> <Core:DataTriggerBehavior Binding=”{Binding IsEnabled, ElementName=MyButton}” Value=”False”> <Core:ChangePropertyAction TargetObject=”{Binding ElementName=MyImage}” PropertyName=”Opacity” Value=”0.5″ /> </Core:DataTriggerBehavior> </Interactivity:Interaction.Behaviors> </Image> </Button> Note that you will need to … Read more

XAML Grid Visibility Transition?

So as a quick example, one way of doing this; <Grid Grid.RowSpan=”2″ x:Name=”TheGrid” Margin=”30,30,0,30″ Visibility=”{Binding IsSearchEnabled, Converter={StaticResource visibilityConverter}}”> <Grid.RowDefinitions> <RowDefinition Height=”60″/> <RowDefinition Height=”*”/> </Grid.RowDefinitions> <!– Start the magic –> <Grid.RenderTransform> <TranslateTransform x:Name=”SlideIn” X=”750″ /> </Grid.RenderTransform> <Grid.Triggers> <EventTrigger RoutedEvent=”Grid.Loaded”> <BeginStoryboard> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetName=”SlideIn” Storyboard.TargetProperty=”X”> <SplineDoubleKeyFrame KeyTime=”0:0:1.25″ Value=”0″ /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName=”TheGrid” Storyboard.TargetProperty=”Opacity”> <SplineDoubleKeyFrame KeyTime=”0:0:1.55″ Value=”1″ /> … Read more

ViewModels in ViewModelLocator MVVM Light

First, lets look at what ViewModelLocator does and why we use it: ViewModelLocator is declared as an object on our App.xaml page and is an application singleton. We’re going to have one, and only one of them available to the application when it runs. ViewModelLocator is the source for all our ViewModels in MVVM Light. … Read more

Newline in string attribute

<TextBlock Text=”Stuff on line1&#x0a;Stuff on line 2″/> You can use any hexadecimally encoded value to represent a literal. In this case, I used the line feed (char 10). If you want to do “classic” vbCrLf, then you can use &#x0d;&#x0a; By the way, note the syntax: It’s the ampersand, a pound, the letter x, then … Read more