我想查询XDocument给定路径的对象,(例如"/ path/to/element/I/want")但我不知道如何继续.
目前我有一个ComboBox定义为:
<ComboBox Name="comboItems" ItemsSource="{Binding Path=EnumDataItems}"
DisplayMemberPath="Description"
ToolTip="{Binding Path=ToolTip}" // never displays the value
SelectedValuePath="Value" SelectedValue="{Binding Path=Value}" />
Run Code Online (Sandbox Code Playgroud)
一切都有效,除了工具提示.它应该绑定的属性; ToolTip 确实包含一个值.我确定这一点,因为当我执行以下操作时,我看到一个结果确认ToolTip包含一个值:
<ComboBox Name="comboItems" ItemsSource="{Binding Path=EnumDataItems}"
DisplayMemberPath="ToolTip" // I replaced 'Description' with 'ToolTip'
ToolTip="{Binding Path=ToolTip}"
SelectedValuePath="Value" SelectedValue="{Binding Path=Value}"/>
Run Code Online (Sandbox Code Playgroud)
替换Description为ToolTipI可以看到ToolTip的值出现在屏幕上.然而
ToolTip="{Binding Path=ToolTip}"
Run Code Online (Sandbox Code Playgroud)
仍然无法正常工作.如果我尝试按如下方式显示ToolTip:
ToolTip="ToolTip"
Run Code Online (Sandbox Code Playgroud)
它只显示"工具提示"一词.
我怎样才能ToolTip显示一个值?
我遇到了Monotouch UIDatePicker落后1小时的问题.我认为这与Time Zones或类似的东西有关.我已经尝试显式设置我的UIDatePicker的TimeZone和Locale,但这似乎没有帮助.
datePicker.Locale = NSLocale.CurrentLocale;
datePicker.TimeZone = NSTimeZone.LocalTimeZone;
Run Code Online (Sandbox Code Playgroud)
在ValueChanged处理程序中,以下行返回比用户界面中选择的时间早1小时的值:
var date = DateTime.SpecifyKind((s as UIDatePicker).Date, DateTimeKind.Local).ToLocalTime();
Run Code Online (Sandbox Code Playgroud)
在ValueChanged Handler中,我仔细检查了Locale和TimeZone是否与设置的相同.TimeZone是欧洲/都柏林和Locale en_US.该信息通过以下方式检索:
datePicker.Locale.LocaleIdentifier;
datePicker.DatePicker.TimeZone;
Run Code Online (Sandbox Code Playgroud)
我还缺少另一个步骤吗?
谢谢!
我有一个用户控件,有几个子元素,包括复选框和文本框.
我想仅在整个用户控件上丢失焦点时触发我的用户控件的LostFocus事件(例如,单击用户控件外部的按钮).
目前,当我在用户控件的子元素之间移动时,LostFocus事件也会触发,例如从一个文本框移动到另一个文本框.
我有一个由3个项目组成的解决方案.我创建了一个部署项目,它只包含我解决方案中某个项目的依赖项.
到目前为止我所做的是在我的安装和部署项目中,我右键单击"应用程序文件夹"添加 - >项目输出.接下来,我从下拉列表中选择了我的主项目并选择了"主要输出".我单击了OK,该项目的依赖项已成功包含在部署中.
我尝试在我的解决方案中为其他DLL重复相同的过程,但它没有包含它们的依赖项.
如何为每个项目包含所有依赖项?
setup-project visual-studio-2010 setup-deployment visual-studio
我正在更新我的iOS应用程序以使用iOS8,但遇到了获取设备令牌以进行远程通知的问题.
我已经更新了我的AppDelegate以RegisterUserNotificationSettings在使用iOS8时调用注册,让以前的版本调用RegisterForRemoteNotificationTypes:
var version8 = new Version (8,0);
if (new Version(UIDevice.CurrentDevice.SystemVersion) < version8)
{
var notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes (notificationTypes);
}
else
{
var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet());
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
}
Run Code Online (Sandbox Code Playgroud)
我的AppDelegate类中还有以下方法:
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
NSString str = (NSString)Runtime.GetNSObject(Messaging.intptr_objc_msgSend(deviceToken.Handle, new Selector("description").Handle));
_deviceTokenString = str.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");
Trace.trace("Device Token: " + _deviceTokenString);
}
Run Code Online (Sandbox Code Playgroud)
和
public override void DidRegisterUserNotificationSettings(UIApplication application, UIUserNotificationSettings notificationSettings)
{ …Run Code Online (Sandbox Code Playgroud) 我有一个我指定为某种类型的方法.
例如
public MyLabels GetLabels<T>()
{
// I'd like to get the namespace of the type that T represents here
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我有一个 TextBox 控件,我希望能够设置背景图像和背景颜色。
目前我可以设置一个,或另一个,但不能同时设置两者。当我尝试同时设置两者时,我收到“属性‘背景’设置多次”错误。
这是我使用的代码:
<TextBox Name="tbImageTextBox">
<TextBox.Background>
<ImageBrush ImageSource="/Resources/Images/image.png"
AlignmentX="Right" Stretch="None"/>
<SolidColorBrush>#FF8D8A8A</SolidColorBrush>
</TextBox.Background>
</TextBox>
Run Code Online (Sandbox Code Playgroud)
我还尝试在 TextBox 的样式和 中的图像中设置背景颜色<TextBox.Background>,但颜色被忽略。
我试图通过代码复制由设计师制作的屏幕,但我遇到了它们已包含在设计中的阴影效果.这是他们实施的阴影效果:

我在XAML中使用投影尝试了这个 - 但它似乎不符合我的要求.由于设计师的阴影看起来更像是物体上有垂直光,投影看起来更像是物体从屏幕弹出.

有没有办法通过WPF实现第一个阴影效果?
我在 Xcode (Organizer > Crashes) 中有我发布的应用程序的堆栈跟踪。我想通过电子邮件将跟踪记录发送给同事,但我无法复制/粘贴跟踪记录。
这可能吗?我是否因为对 OSX 不太熟悉而遗漏了一些非常明显的东西?