Tag: silverlight

SilverLight DataGrid:复制和粘贴

有没有办法可以从SilverLight DataGrid中选择一堆行或单元格并将它们复制粘贴到例如excel中? DataGrid似乎没有内置此function! 非常感谢

System.NullReferenceException未将对象引用设置为对象的实例

所以,我明白了 System.NullReferenceException Object reference not set to an instance of an object. at Microsoft.Windows.Design.Platform.SilverlightMetadataContext.SilverlightXamlExtensionImplementations.d__8.MoveNext() at MS.Internal.Design.Metadata.ReflectionProjectNode.BuildSubsumption() at MS.Internal.Design.Metadata.ReflectionProjectNode.SubsumingNamespace(Identifier identifier) at MS.Internal.Design.Markup.XmlElement.BuildScope(PrefixScope parentScope, IParseContext context) at MS.Internal.Design.Markup.XmlElement.ConvertToXaml(XamlElement parent, PrefixScope parentScope, IParseContext context, IMarkupSourceProvider provider) at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean convertToXamlWithErrors) at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem() at Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem() at Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState() at MS.Internal.Host.PersistenceSubsystem.Load() at MS.Internal.Host.Designer.Load() at MS.Internal.Designer.VSDesigner.Load() at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load() at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view) at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory […]

C# – Silverlight中的.NET ArrayList.ToArray(Type)替换

下面是我编写的一个简单的方法(非常简化,所以我希望它仍然得到了jist),用于在字符串中获取数组元素的字符串表示,并将它们转换为这些值的实际数组。 t是数组的类型。 DeserializeArray(string sArrayElements, out Array aValues, Type t) { string[] sValues = ProcessArrayElements(sArrayAsString); ArrayList alValues = new ArrayList(sValues.Length); for(int i = 0; i < sValues.Length; ++i) alValues.Add(ProcessValue(sValues[ i ] )); aValues = alValues.ToArray(t.GetElementType()); return true; } 然后我将使用此方法与下面的代码。 propertyInfo是对象的属性,在本例中为.IsArray()== true。 sArrayElements只是包含数组的字符串表示forms的字符串(“val1,val2,…,valN”) Array aValues; if (DeserializeArray(sArrayElements, out aValues, propertyInfo.PropertyType)) propertyInfo.SetValue(oObject, aValues, null); else throw new FormatException(“Unable […]

WPF / Silverlight程序员:MVVM是否过度杀伤?

我对MVVM的看法很复杂。 似乎我需要编写如此多的代码来获得最有效的补救措施。 我想念事件(命令是如此痛苦),绑定一切导致调试噩梦,我错过了对视图的引用! 我只是想知道你对MVVM的感受与背后的普通旧代码。 你更喜欢什么和/或你通常使用或推荐使用什么? 谢谢

Windows Phone 8中的WriteableBitmap内存泄漏

每当我创建WriteableBitmap任何实例时,我都会发生内存泄漏。 我已经在stackoverflow和其他论坛上尝试了多个建议,但没有任何工作。 我的测试应用程序的基本流程如下: 使用PhotoChooserTask选择图像 使用PhotoResult对象中的Stream创建WriteableBitmap 。 而已。 取消变量并调用GC.Collect()只能解决部分问题。 它使应用程序不会分配内存,直到应用程序崩溃,但即使对象超出范围,在我选择新图像之前总是会为它们分配内存。 我可以使用默认的Windows Phone Direct3D和XAML App重现它。 对默认项目的唯一修改如下: MainPage.xaml.cs中 public MainPage() { InitializeComponent(); _photoChooserTask = new PhotoChooserTask(); _photoChooserTask.Completed += new EventHandler(photoChooserTaskComplete); } private void ApplicationBarIconButton_Click(object sender, EventArgs e) { _photoChooserTask.Show(); } private void photoChooserTaskComplete(object sender, PhotoResult e) { if (e.TaskResult == TaskResult.OK) { BitmapImage image = new BitmapImage(); image.SetSource(e.ChosenPhoto); […]

如何在Silverlight / C#中访问ListBox控件的ScrollViewer元素?

我希望从C#动态更改Silverlight ListBox的滚动位置,我需要知道如何从C#访问ListBox控件的ScrollViewer元素? 谢谢你们,杰夫

需要在C#应用程序中从摄像头捕获video流

我需要构建一个满足以下要求的应用程序。 它可以是Windows客户端,Silverlight客户端或WPF客户端。 屏幕将在2个独立的窗口中显示来自2个独立摄像头的video流 需要具有PVR类型的function…… 2.1显示实时流2.2暂停和播放前30秒的video 我正在尝试使用我拥有的C#应用​​程序开发资源但是我没有任何video捕获经验。 我可以看一下图书馆方面的帮助或最好的方法。 谢谢Cronline

.Net RIA服务:DomainService需要一个无参数的构造函数?

我在带有一些Silverlight组件的ASP.Net应用程序中使用.Net RIA Services的July CTP。 我从Silverlight打电话给RIA服务。 当我尝试在我的域服务(LinqToEntitiesDomainService对象)中使用Unity和构造函数dependency injection时出现了我的问题。 Silverlight应用程序现在抱怨没有无参数构造函数。 我不想拥有无参数构造函数,我希望Unity能够解析构造函数参数。 这可能吗? 难道我做错了什么? 或者我应该找到另一种方法来注入我的构造函数参数? public class DashboardService : LinqToEntitiesDomainService { private IUserService userService; public DashboardService(IUserService userService) : base() { if (userService == null) { throw ExceptionBuilder.ArgumentNull(“userService”); } this.userService = userService; } … 这是我得到的错误: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET […]

代码隐藏中的数据绑定到CLR属性

在代码隐藏中很容易绑定到依赖属性。 您只需创建一个新的System.Windows.Data.Binding对象,然后调用目标依赖项对象的SetBinding方法。 但是当我们绑定的属性是CLR属性而你不能为SetBinding提供DependencyProperty参数时, SetBinding怎么SetBinding ? 编辑:对象实现INotifyPropertyChanged ,如果相关的话。

在Windows Phone 7的MVVM应用程序中使用REST Web服务的良好架构?

我在确定从Web服务到UI获取数据的最佳方法时遇到了一些麻烦。 鉴于WebClient的异步性质,您将如何构建它? Model使用WebClient与webservice通信 ViewModel向模型询问数据 View是数据绑定到ViewModel 在Async完成事件中,我需要将数据从模型中取回ViewModel,这些是我想到的。 我可以在模型中触发ViewModel订阅的事件。 我或许可以做一些传递回调的事情? 或者我应该在ViewModel和Model之间进行第二级的INotifyPropertyChanged事件? 或者我非常困惑并完全误解MVVM?