Tag: silverlight

带有图像或路径的自定义滑块

我的WP7应用程序中有一个滑块,我想重新设置。 我有默认模板的问题 我做了这样的事情,但我不能将拇指“绑定”到价值上。 上下移动它。

将图像分成几块silverlight窗口手机

我想使用Silverlight for windows phone 7.5将图像分割成几个较小的图像。 首先,我想知道这是否可能(我最近对Windows Phone API有一些令人不快的意外),如果是,请给我一些例子,因为我能够找到完全没有。 谢谢您的帮助。

Rx:忽略订阅者导致的更新

我在弄清楚如何做到这一点时遇到了问题。 我有两个实现INotifyPropertyChanged实例(源和目标),我正在跟踪两者的PropertyChanged事件。 我想要做的是在任何时候运行一个动作source.PropertyChanged ,直到target.PropertyChanged被引发。 我可以这样做,就像这样: INotifyPropertyChanged source; INotifyPropertyChanged target; var sourcePropertyChanged = Observable .FromEvent(source, “PropertyChanged”) .Where(x => x.EventArgs.PropertyName == sourcePropertyName); var targetPropertyChanged = Observable .FromEvent(target, “PropertyChanged”) .Where(x => x.EventArgs.PropertyName == targetPropertyName); sourcePropertyChanged .TakeUntil(targetPropertyChanged) .ObserveOnDispatcher() .Subscribe(_ => /*Raises target.PropertyChanged for targetPropertyName*/); 我遇到的问题是我想忽略由操作引起的PropertyChanged通知,并且只有在外部源引发PropertyChanged事件时才停止获取值。 是否有一种很好的方法可以实现这一目标?

调查XMLWriter对象

如何在调试时查看完全填充的XmlWriter对象的XML内容。 我的silverlight应用程序不允许实际写入文件并检查内容。

Listpicker多选和DisplayMemberPath

我有一个使用ItemsSource属性绑定到listpicker的自定义实体的集合。 我也有选择模式设置为Multiple所以我有一个复选框与FullMode选择器中的每个项目。 这种选择很好,我可以轻松访问通过代码挑选的所有对象。 我遇到麻烦的是DisplayMemberPath 。 我想显示比所选对象的命名空间更友好的东西。 可能是所选项目的计数,或所选值的逗号分隔列表。 不幸的是,当我设置SelectionMode =“Multiple”时,’AccountId’不起作用。 单模式很好。 有任何想法吗?

WPF自定义控件的ToolTip MultiBinding问题

当我在WPF自定义控件中设置工具提示绑定时,这种方式非常完美: public override void OnApplyTemplate() { base.OnApplyTemplate(); … SetBinding(ToolTipProperty, new Binding { Source = this, Path = new PropertyPath(“Property1”), StringFormat = “ValueOfProp1: {0}” }); } 但是当我尝试使用MultiBinding在ToolTip中有多个属性时,它不起作用: public override void OnApplyTemplate() { base.OnApplyTemplate(); … MultiBinding multiBinding = new MultiBinding(); multiBinding.StringFormat = “ValueOfProp1: {0}\nValueOfProp2: {1}\nValueOfProp3: {2}\n”; multiBinding.Bindings.Add(new Binding { Source = this, Path = new PropertyPath(“Property1”) }); […]

有效地转换音频字节 – byte 到short

我正在尝试使用XNA麦克风捕获音频并将其传递给我分析数据用于显示目的的API。 但是,API需要16位整数数组中的音频数据。 所以我的问题相当直截了当; 什么是将字节数组转换为短数组的最有效方法? private void _microphone_BufferReady(object sender, System.EventArgs e) { _microphone.GetData(_buffer); short[] shorts; //Convert and pass the 16 bit samples ProcessData(shorts); } 干杯,戴夫 编辑 :这是我提出的,似乎工作,但它可以更快地完成吗? private short[] ConvertBytesToShorts(byte[] bytesBuffer) { //Shorts array should be half the size of the bytes buffer, as each short represents 2 bytes (16bits) short[] shorts = new short[bytesBuffer.Length / […]

如何绑定到silverlight中的页面属性?

我在代码隐藏中有一个带有布尔属性的silverlight页面。 在xaml中我有一个tabcontrol,其中一个tabitem的内容是一个忙碌的指示器。 我想将busyindicator的isbusy属性绑定到代码隐藏中的boolean属性,但无论我使用什么绑定语句,我都无法解析它。

如何在SilverLight中组合一些UserControl?

也许这是一个简单的问题,但我找不到答案。 我有三个用户控件,只有颜色不同。 其中有一个代码: 如何将它们组合成ObservableCollection Children? public class NodeViewModel : INotifyPropertyChanged { public ObservableCollection Children { get { return _children; } set { _children = value; NotifyChange(“Children”); } } private void NotifyChange(string propName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propName)); } } 我如何使用此控件集合的then元素? 这样做有简单(或正确的方法)吗?

DesignerProperties.IsInDesignMode和DesignerProperties.IsInDesignTool之间有什么区别?

DesignerProperties使用GetIsInDesignMode(element)和IsInDesignTool公开两个类似的设计状态。 它们之间有什么区别? 我为什么要使用一个而不是另一个?