Where is the generic.xaml file located?

You can find the default generic.xaml inside each WindowsAppSDK NuGet package folder. For example, in the case of WindowsAppSDK v1.2.230118.102, you can find 3 generic.xaml files. First, let’s locate the folder for the WindowsAppSDK v1.2.230118.102 NuGet package. C:\Users\USERNAME\.nuget\packages\microsoft.windowsappsdk\1.2.230118.102 Note: Replace USERNAME with your user name. Now, inside this folder you’ll find 3 generic.xaml files. \lib\net6.0-windows10.0.17763.0\Microsoft.WinUI\Themes\generic.xaml … Read more

XAML/C#: What event fires after reordering a gridview?

You cannot reorder a GridView unless the ItemsSource is bound to an ObservableCollection and CanReorderItems, CanDragItems, and AllowDrop are set to true. It is not necessary to use a CollectionViewSource to enable reordering in your gridview. In fact, a collectionviewsource is often used for grouping a gridview and reordering is not possible when data is … Read more

Windows Phone 8.1 Toggling the visibility of a TextBlock in a DataTemplate

The problem I’m having is that I can’t access the TextBlock from the C# code. Yes, since the TextBlock is defined inside a DataTemplate, the TextBlock won’t be available until the DataTemplate has been applied. Thus, the x:Name attribute won’t automatically generate a variable reference in the InitializeComponent method in your *.g.i.cs file. (Read up … Read more

DataTrigger in WinRT?

DataTrigger is not currently supported in WinRT XAML. Addendum by Mike Brown The DataTrigger API has been replaced with the VisualStateManager a similar API to Data Triggers was provided by the Blend SDK for Silverlight. Since the Attached Behavior Pattern works in WinRT, it is possible to do the same.

WPF Fade Animation

I don’t know how to do both animations (fade in and fade out) in pure XAML. But simple fade out can be achieved relatively simple. Replace DataTriggers with Triggers, and remove ExitActions since they makes no sense in Fade out scenario. This is what you will have: <Style TargetType=”FrameworkElement” x:Key=”animatedList”> <Setter Property=”Visibility” Value=”Hidden”/> <Style.Triggers> <Trigger … Read more

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