uwp

Binding command in UWP

南楼画角 提交于 2019-12-04 19:15:28
I have a MenuFlyout in my App.xaml: <Application.Resources> <MenuFlyout x:Key="LessonFlyout"> <MenuFlyoutItem Text="Edit"/> <MenuFlyoutItem Text="Delete"/> </MenuFlyout> </Application.Resources> And I wanted to give MenuFlyoutItem click event but the compiler says I can't do this. But I need a click event so I searched and found out that I can bind command to MenuFlyoutItem. My MenuFlyout will be attached to a different objects in different pages. For example: StackPanel thisSender = sender as StackPanel; FlyoutBase.SetAttachedFlyout(thisSender, Application.Current.Resources["LessonFlyout"] as

Swing: Create a UWP (“Metro”)–like button

跟風遠走 提交于 2019-12-04 19:13:46
I'd like to design a Swing button that would look like an UWP one – like so [Windows Settings App]: This is what I have so far: using the following code: Font f = new Font("Segoe UI", Font.PLAIN, 20); Color gray = new Color(204, 204, 204); button.setFont(f); button.setBackground(gray); button.setContentAreaFilled(false); button.setFocusPainted(false); button.setFocusable(false); button.setForeground(Color.BLACK); button.setBorder(BorderFactory.createEmptyBorder(10, 14, 10, 14)); The background color cannot be changed at all, regardless whether button.setContentAreaFilled(Boolean b); property

Insufficient memory to continue the execution of the program when trying to initialize array of InkCanvas in UWP

余生长醉 提交于 2019-12-04 19:11:53
Here is my code: public sealed partial class MainPage : Page { InkCanvas[] arrInkCanvas = null; public MainPage() { this.InitializeComponent(); int i = 0; arrInkCanvas = new InkCanvas[1000]; try { for (i = 0; i < 1000; i++) { arrInkCanvas[i] = new InkCanvas(); } } catch (Exception ex) { } } } When i run this code in WPF app there's no problem , but in UWP it throws exception : "Insufficient memory to continue the execution of the program." Is it bugs or something can anyone tells me ? Thanks. Windows OS will balance the memory located to the application based on RAM and OS configuration. You

Why does this ScrollViewer's ScrollBars appear twice?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 19:03:09
I edited a ScrollViewer 's template to wait only 0.5 seconds before hiding the scrollbars, and this succeeds in hiding them at that time, but they reappear for another 0.5 seconds. Why? To reproduce, create a page resource for a ScrollViewer's Style with the default Template ( find it here on MSDN ) and change the 3 occurances of "3" to "0.5". Then use the following XAML: <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <ScrollViewer Height="500" Width="500" Style="{StaticResource ScrollViewerControlTemplate1}"> <Grid Background="Blue" Height="1000" Width="1000"> </Grid>

Determine if C++ application is running as a UWP app, with legacy support

让人想犯罪 __ 提交于 2019-12-04 18:40:48
My first thought was to use GetPackageFamilyName() and look for ERROR_SUCCESS vs APPMODEL_ERROR_NO_PACKAGE . But, I need to support Windows 7, which makes GetPackageFamilyName() unusable. Is there a decent alternative method? Anything in the Registry, perhaps? Use GetProcAddress() to load GetPackageFamilyName() dynamically at runtime, eg: typedef LONG WINAPI (*LPFN_GPFN)(HANDLE, UINT32*, PWSTR); bool bIsUWP = false; LPFN_GPFN lpGetPackageFamilyName = (LPFN_GPFN) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetPackageFamilyName"); if (lpGetPackageFamilyName) { UINT32 size = 0; if

UWP: How to catch the click of a listview part from another listview in the viewmodel instead of code-behind?

时光毁灭记忆、已成空白 提交于 2019-12-04 18:10:01
I have this listview: <Page x:Class="DataBase.ControlsPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding CustomersViewModel, Source={StaticResource ViewModelLocator}}"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <ListView Name="HeaderList" ItemsSource="{Binding Customers}"> <ListView.ItemTemplate> <DataTemplate> <Grid> <Border Background="Bisque"> <TextBlock Text="{Binding Name"/> </Border> <ListView Name="SubItemsList" ItemsSource="{Binding Project}" ItemClick=

Is it possible to use compiled binding (x:Bind) with Relative Source, Templated Parent

佐手、 提交于 2019-12-04 17:53:08
I'd like to do something like this is a Style: Value="{x:Bind MyCustomDependencyProp, RelativeSource={RelativeSource TemplatedParent}}" Is that possible? Are there any performance benefits? Using TemplateBinding does not seem to work, with a custom DependencyProperty as described elsewhere here on SO: https://stackoverflow.com/a/8657453 RelativeSource (with x:Bind) is not supported, therefore this particular scenario won't be possible (at the moment, at least). Using TemplateBinding or standard Binding to TemplatedParent (as you mentioned) are workarounds. TemplateBinding is already an

Payload contains two or more files with the same destination path 'System.Diagnostics.Tools.dll'

核能气质少年 提交于 2019-12-04 17:43:10
问题 After I add 2 libraries from Nuget to my project I receive follow error: Error Payload contains two or more files with the same destination path 'System.Diagnostics.Tools.dll'. Source files: C:\Users\Horcrux7\.nuget\packages\runtime.any.System.Diagnostics.Tools\4.0.1\lib\netcore50\System.Diagnostics.Tools.dll C:\Users\Horcrux7\.nuget\packages\System.Diagnostics.Tools\4.0.0\lib\netcore50\System.Diagnostics.Tools.dll App1 How can I solve this version conflict? I have only a very small single

How to animate scale of TextBlock in UWP

我与影子孤独终老i 提交于 2019-12-04 17:10:06
When I use Storyboard to zoom in TextBlock it pixelates while zooming and rerenders only on complete. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TextBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1.5"/> Is there a way the TextBlock is rerendered each frame? I found a solution though it's not about TextBlock anymore but for me it worked: private void CreateText(string text) { _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; CreateDevice(); _spriteTextVisual =

DatePicker Flyout Presenter Style

a 夏天 提交于 2019-12-04 16:44:48
I'm looking for a way to edit the DatePickerFlyoutPresenter scroll box style. I want to change the text to white the arrow buttons and change the pointover colors but cant seem to find it. could it be useing flipview style? I am using xaml/C# http://puu.sh/lKvcW/a921089600.png From the Live Visual Tree of Visual Studio, we can find DatePickerFlyoutPresenter use LoopingSelector in it. So to change the color of the text in arrow button, we can change the template of Windows.UI.Xaml.Controls.Primitives.LoopingSelector , and we can find it in generic.xaml which typical in C:\Program Files (x86)