windows-runtime

Retrieve display value of combobox winrt

牧云@^-^@ 提交于 2019-12-11 06:06:34
问题 I set the DisplayMemberPath of a comboBox as well as the ItemsSource , now i'm trying to retrieve the selectedText that is displayed but there is no selectedText property. I tried string s = comboBoxItem.SelectedItem.ToString(); but i'm getting a weird value. How do I retrieve the Displayed value of the comboBox 回答1: For comboBox1 , in C# winforms, you can get the selected value with comboBox1.SelectedItem.ToString() . In WPF (what apparently you want), you can get this information directly

Why doesn't implicit conversion from integer to byte work with the conditional operator?

痴心易碎 提交于 2019-12-11 05:53:22
问题 The MSDN page for byte says that you can declare a byte like this: byte myByte = 255; and that In the preceding declaration, the integer literal 255 is implicitly converted from int to byte. If the integer literal exceeds the range of byte, a compilation error will occur. So I'm struggling to understand why the following gives me a compile error of 'cannot implicitly convert type 'int' to 'byte') byte value = on ? 1 : 0; // on is defined as a bool earlier I'm compiling this on VS 2012 as a

Don't always get a 226 Transfer OK at the end of an FTP upload

大憨熊 提交于 2019-12-11 05:53:00
问题 With an FTP client I've written I will sometimes receive a 226 Transfer OK message from the FileZilla server after an upload completes, and sometimes I won't ever receive anything. And it's not that the client disconnected before the 226 Transfer OK was received, because I can see on the server that FileZilla never sent it. I need to know when the server has received the complete upload, because I otherwise do not know if the whole file made it to the network before I close the connection.

How do I call the base class implementation TextBox::OnKeyDown() in my override?

痞子三分冷 提交于 2019-12-11 05:14:48
问题 I have created a subclass of the TextBox class so that I can capture all keyboard events in the OnKeyDown() method ( the KeyDown event will not trigger for all keyboard events, including but not limited to, backspace and arrow-keys, but OnKeyDown will) . The problem with this is that it effectively disables the TextBox, as it bypasses the control's internal keyboard handling entirely. The obvious solution is to call OnKeyDown in the superclass. How do I do that in Windows Runtime? Just

How to set same animation to dynamically created images in winRT?

血红的双手。 提交于 2019-12-11 05:13:42
问题 I have a set of images which are generated dynamically in a for loop.My objective is to add same storyboard animation to all these same images.I created the animation but while applying it in for loop it can apply only one after another because root animation must stop before.How can I achieve this? Thanks in advance 回答1: You can only use an animation with a single target so you need to duplicate the animation to apply it to multiple targets. One option is to create the storyboard in code

How to bind a TextBlock in a template, defining the ListBoxItem of a ListBox, to the IsSelected property of the parent ListBoxItem?

陌路散爱 提交于 2019-12-11 04:59:45
问题 I have a List box defined like this: <ListBox x:Name="EmailList" ItemsSource="{Binding MailBoxManager.Inbox.EmailList}" SelectedItem="{Binding SelectedMessage, Mode=TwoWay}" Grid.Row="1"> <ListBox.ItemTemplate> <DataTemplate> <usrctrls:MessageSummary /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> The UserControl is defined like this: <UserControl x:Class="UserControls.MessageSummary" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com

Windows store xaml and c# how to create accordian style list

倾然丶 夕夏残阳落幕 提交于 2019-12-11 04:58:13
问题 I have a ListView IsGroupedSource is set to true in it's CollectionViewSource. I'm trying to toggle a groups visibility when it's group header is clicked. <CollectionViewSource x:Name="FiltersViewSource" Source="{Binding Filters}" IsSourceGrouped="true" ItemsPath="AttributeValues" /> <ListView x:Name="filtersListView" AutomationProperties.AutomationId="ItemListView" AutomationProperties.Name="Grouped Items" Grid.Row="1" Margin="0,-10,0,0" Padding="30" ItemsSource="{Binding Source=

Hard-coded PCH name in WinRT XAML

孤人 提交于 2019-12-11 04:55:48
问题 WinRT project, C++/CX. When my XAML files are compiled, the generated code files contain an #include "pch.h" line. I want my precompiler header to be called differently - stdafx.h , for legacy code reasons. Changing it in project properties affects C++ sources, but not the XAML compiler - it still emits the pch.h line. I could not find XAML compiler settings anywhere in the project properties. How do I change the PCH name that XAML compiler assumes, please? 回答1: The name of the precompiled

How to set an Alarm or Reminder events in Windows 8?

六眼飞鱼酱① 提交于 2019-12-11 04:48:41
问题 Do we have a functionality in Windows 8 where I can set an Alarm or a Reminder (with recurrence!!) and forget about it (and the OS will do the rest)? Or do I need to create a background task to do the work? It is not hard to schedule one event but I would not want to schedule a whole set of recurrence events. The calendar is already doing it, can I tie into this mechanism? 回答1: You can use Scheduled Notifications but there's a limit of 4096 of those, so the recommendation for a recurring task

Avoid XAML Designer error with custom controls

半腔热情 提交于 2019-12-11 04:19:37
问题 Let's say that I have a custom control that inherits from another control. I want to set some properties of this control, so I add something like this inside the constructor, for example: public class MyControl : Canvas { public MyControl() { if (getSomeTestValueFromAppSettings()) { this.Background = ColorConverter.MyStaticBrushProperty1; } else { this.Background = ColorConverter.MyStaticBrushProperty2; } } } Now, everything works fine inside the app, so no problems there. The point is that