winrt-xaml

Display message when ListView contains no items with MVVM in a UWP

[亡魂溺海] 提交于 2021-01-21 08:33:37
问题 This is my first MVVM project and the code I need to write to manipulate controls in the view somehow seems way too complicated than it has to be. I'm finding it hard to fully understand MVVM and to decide when I can put stuff in code behind. Basically my problem is that I want to show a message telling the user that the listview is empty when the ObservableCollection it is bound to contains no items. The idea was to have a TextBlock in the view and only have its visibility property set to

How can I force the TextBox to display what is being entered into it?

自闭症网瘾萝莉.ら 提交于 2020-12-27 06:36:38
问题 In my UWP app, I am invoking a ContentDialog when a button (btnCre8NewMap) is clicked. Here is the pertinent XAML: <Button x:Name="btnCre8NewMap" Content="Create New Map" ToolTipService.ToolTip="Create a new map" Margin="140,16,50,0" VerticalAlignment="Top" Click="btnCre8NewMap_Click"/> . . . <ContentDialog x:Name="cntDlgCre8Map" Title="Create a New Map" PrimaryButtonText="Save" CloseButtonText="Cancel" DefaultButton="Primary"> <StackPanel> <TextBlock Text="Map Name: "/> <TextBox x:Name=

Windows 8 WinRT KeyboardCapabilities.KeyboardPresent is always true

空扰寡人 提交于 2020-06-14 06:49:35
问题 We are using KeyboardCapabilities.KeyboardPresent to test if a keyboard is connected to a device: bool hasKeyboard = new KeyboardCapabilities().KeyboardPresent == 1; Unfortunately it's always TRUE regardless if a bluetooth keyboard is connected or not. We tried it with the following hardware: Dell Vostro 470 is a desktop PC with wireless Bluetooth keyboard which has power ON/OFF options. http://www.dell.com/in/business/p/vostro-470/pd Samsung 700T Notebook (Slate) http://www.samsung.com/uk

Change propety Canvas.Left and Canvas.Top in codebehind WinRT

泪湿孤枕 提交于 2020-03-18 11:30:36
问题 <Button x:Name="PlayButton" Content="Play" Canvas.Left="570" Canvas.Top="36" Height="51" Width="202" Background="#FF8898F9" /> How change Canvas.Top and Canvas.Left property of PlayButton in the code? 回答1: Canvas class has SetTop and SetLeft static methods that set these attached properties: Canvas.SetTop(PlayButton, 36); Canvas.SetLeft(PlayButton, 750); 回答2: Canvas.SetLeft(PlayButton, 100); Canvas.SetTop(PlayButton, 50); 来源: https://stackoverflow.com/questions/21515135/change-propety-canvas

Change propety Canvas.Left and Canvas.Top in codebehind WinRT

独自空忆成欢 提交于 2020-03-18 11:30:14
问题 <Button x:Name="PlayButton" Content="Play" Canvas.Left="570" Canvas.Top="36" Height="51" Width="202" Background="#FF8898F9" /> How change Canvas.Top and Canvas.Left property of PlayButton in the code? 回答1: Canvas class has SetTop and SetLeft static methods that set these attached properties: Canvas.SetTop(PlayButton, 36); Canvas.SetLeft(PlayButton, 750); 回答2: Canvas.SetLeft(PlayButton, 100); Canvas.SetTop(PlayButton, 50); 来源: https://stackoverflow.com/questions/21515135/change-propety-canvas

How do you bind to the property of a User Control?

心已入冬 提交于 2020-02-27 02:26:34
问题 In Windows Store Apps, you create a user control to encapsulate and reuse code-behind and layout XAML. A simple user control might look like this: <UserControl> <StackPanel> <TextBlock Text="First Name" /> <TextBox x:Name="MyTextBox" /> </StackPanel> </UserControl> Now, I want to setup binding. So I create code-behind with properties that expose the Text properties of the UI controls. Something like this: public string TextBoxText { get { return MyTextBoxText.Text; } set { MyTextBoxText.Text

How do you bind to the property of a User Control?

不羁的心 提交于 2020-02-27 02:26:17
问题 In Windows Store Apps, you create a user control to encapsulate and reuse code-behind and layout XAML. A simple user control might look like this: <UserControl> <StackPanel> <TextBlock Text="First Name" /> <TextBox x:Name="MyTextBox" /> </StackPanel> </UserControl> Now, I want to setup binding. So I create code-behind with properties that expose the Text properties of the UI controls. Something like this: public string TextBoxText { get { return MyTextBoxText.Text; } set { MyTextBoxText.Text

How do you bind to the property of a User Control?

风流意气都作罢 提交于 2020-02-27 02:24:47
问题 In Windows Store Apps, you create a user control to encapsulate and reuse code-behind and layout XAML. A simple user control might look like this: <UserControl> <StackPanel> <TextBlock Text="First Name" /> <TextBox x:Name="MyTextBox" /> </StackPanel> </UserControl> Now, I want to setup binding. So I create code-behind with properties that expose the Text properties of the UI controls. Something like this: public string TextBoxText { get { return MyTextBoxText.Text; } set { MyTextBoxText.Text

WPF multiple Font files of the same family

只愿长相守 提交于 2020-02-24 04:20:49
问题 I have the following font files. MyFont-Regular.tff MyFont-Bold.tff MyFont-Italic.tff How do I use them? I can do the following, <TextBlock FontFamily="/Fonts/MyFont/MyFont-Regular.ttf#My Font" Text="This is my font"/> By what if i wan't to use styles like italic and bold? Can't i declare that My Font consists of several files each containing the fonts style? 回答1: You cannot. You can, however, wrap your custom font into a style/resource: <App.Resources> <FontFamily x:Key="CustomRegular">

How to make EntranceThemeTransition works on a Custom Panel & ItemsSource?

孤街浪徒 提交于 2020-02-16 02:41:26
问题 I can't get EntranceThemeTransition to work on a custom panel as ItemsPanelTemplate. See: Simplest code behind: public List<int> MyListExample = new List<int>() {0, 1, 2, 3, 4, 5}; Simplest XAML: <ListView Width="120" ItemsSource="{x:Bind MyListExample}"> <ListView.ItemContainerTransitions> <TransitionCollection> <EntranceThemeTransition FromVerticalOffset="200" IsStaggeringEnabled="True"/> </TransitionCollection> </ListView.ItemContainerTransitions> <ListView.ItemsPanel> <ItemsPanelTemplate>