uwp-xaml

XAML Custom Textbox Events and Properties not Updating in Real Time

本小妞迷上赌 提交于 2019-12-11 07:31:37
问题 After a creating and changing my custom Win 8.1/UWP TextBox control to inherit from TextBox and wiring up the TextChanged event, the Text property is not accurate when subscribing to the TextChanged event. Here's my control: [TemplatePart(Name = "PART_ctlTextBox", Type = typeof(TextBox))] public class CustomTextBox : Control { public CustomTextBox() { DefaultStyleKey = typeof(CustomTextBox); } protected override void OnApplyTemplate() { base.OnApplyTemplate(); var textBox = GetTemplateChild(

Cannot get Keyboard Accelerators to work…AT ALL

旧巷老猫 提交于 2019-12-11 07:29:19
问题 I've also posted this question to Microsoft's Documentation here. I am trying to implement both Access Keys and Keyboard Accelerators in a UWP app, which, as I understand it, is "good coding practice". Here is a snippet from MainPage.xaml where I try to implement the "open" shortcut key of "Ctrl+O" <MenuFlyoutItem Text="Open" AccessKey="O" Click="menuFileOpen"> <MenuFlyoutItem.KeyboardAccelerators> <KeyboardAccelerator Modifiers="Control" Key="O" Invoked="menuFileOpen"/> </MenuFlyoutItem

Cannot Save Decimal Property from UWP TextBox

我与影子孤独终老i 提交于 2019-12-11 06:55:18
问题 I have 2 TextBoxes in UWP. They are bound to integer and decimal properties on the model entity. The integer property is saved but the decimal returns the error Cannot save value from target back to source. BindingExpression: Path='ComponentDec' DataItem='Orders.Component'; target element is 'Windows.UI.Xaml.Controls.TextBox' (Name='null'); target property is 'Text' (type 'String'). The relevant XAML is: <ListView Name="ComponentsList" ItemsSource="{Binding Components}"> <ListView

Items in ItemsControl takes width of First Item

淺唱寂寞╮ 提交于 2019-12-11 06:12:06
问题 WrapGrid in ItemsControl takes the width of the first item as the default width of all children items. Is there any workaround to make the itemwidth stretch according to each individual item's content? Here's My XAML. <Grid Grid.Row="2"> <ItemsControl Grid.Column="1" ItemsSource="{x:Bind articleTags}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapGrid Orientation="Horizontal"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Border

Multiple DataTemplates with UWP MapItemsControl

五迷三道 提交于 2019-12-11 06:04:17
问题 I have a MapControl in UWP: <maps:MapControl x:Name="BikeMap" ZoomLevel="17" Center="{Binding CenterPoint, Mode=TwoWay}"> <maps:MapItemsControl x:Name="MapItems" ItemsSource="{Binding BikePoints}" ItemTemplate="{StaticResource BikePointTemplate}"/> </maps:MapControl> and am adding MapElements using XAML data templates, my ItemsSource is a list of simple objects. But, UWP doesn't seem to provide a way to specify the DataType of a DataTemplate and the MapItemsControl doesn't have a property for

How to rotate image placed on a Mapcontrol

坚强是说给别人听的谎言 提交于 2019-12-11 05:56:56
问题 The issue I've got an application that tracks vehicles on a map. However I cannot get the little buggers to rotate in the direction of their motion. Basically, all of them are going sideways! Ugh! The code Image vehicleImage = new Image { //Set image size and source }; RenderTransform rotation= new RotateTransform{Angle = X}; vehicleImage.RenderTransfrom = rotation; _mainMap.Children.Add(vehicleImage); MapControl.SetLocation(vehicleImage, _position); The Image, placed on the map, seems to

Unable to refresh a CalendarView with UpdateLayout() [UWP]

a 夏天 提交于 2019-12-11 05:36:19
问题 In my UWP app, I'm trying to refresh the density bars on a calendarview if the user clicks a button, the problem is that, although calendarView.UpdateLayout(); should re-run the CalendarViewDayItemChanging event, it runs only when the CalendarView is loaded the first time. Am I doing something wrong? public MainPage() { this.InitializeComponent(); densityColors.Add(Colors.Green); } private void CalendarView_CalendarViewDayItemChanging(CalendarView sender, CalendarViewDayItemChangingEventArgs

ListViewItem Horizontal Strechting UWP 10

梦想的初衷 提交于 2019-12-11 05:23:54
问题 I want to horizontally stretch a ListView in UWP 10. I also set the HorizontalContentAlignment to Stretch . It kinda works, but its not exactly the result i wanted. I set the ListView background to Aqua so, you could see, that the ListView itself is strechting to 100%. The content is also strechting, but I got this space on the left and on the right. So my question is: How can i remove those "margins" left and right? Here is the result: And here is the XAML: <Grid Background="{ThemeResource

Binding through IDictionary<string,object> property changed event handler is null

血红的双手。 提交于 2019-12-11 05:10:07
问题 I have a class FormItem which implements an IDictionary<string, object> , when I bind the Value property of the FormItem , the PropertyChanged event is always null, but when I remove the IDictionary from FormItem then the FormItem.PropertyChanged event is not null. I want to know why it is null when I am implementing IDictionary and how it can be fixed. Example public class FormItem : INotifyPropertyChanged, IDictionary<string, object> { public int _value; public int Value { get { return

Programmatically add buttons to a UWP app

◇◆丶佛笑我妖孽 提交于 2019-12-11 04:47:50
问题 Suppose my app has one button that adds another button. If I press it, another button should appear right next to the first button. Also, the new button should become the "add a new button"-button. How do I do this? My approach was creating a RelativePanel, because in the Editor, you can say "Place this left of that". However, it can't find a way to do that in C# code. 回答1: You can follow ctron's comment and do it via setting attached property value in the code. The sample can look like this