Tag: wpf

将Kinect的彩色摄像机video流保存到.avivideo中

我想将Kinect的彩色相机捕获的video流保存为.avi格式video,我尝试了很多方法,但没有成功。 有没有人成功完成这个? 我正在使用Kinect for Windows SDK和WFP进行应用程序开发

在WPF中使用Unity解析时,SynchronizationContext.Current为null

我有一个看起来像这样的WPF代码。 public class AlphaProductesVM : BaseModel { private ObservableCollection _NwCustomers; private int i = 0; public AlphaProductesVM () { _NwCustomers = new ObservableCollection(); var repository = new NorthwindRepository(); repository .GetAllProducts() .ObserveOn(SynchronizationContext.Current) .Subscribe(AddElement); } public void AddElements(IEnumerable elements) { foreach (var alphabeticalListOfProduct in elements) { AddElement(alphabeticalListOfProduct); } } public ObservableCollection NwCustomers { get { return _NwCustomers; […]

如何正确引用XAML中的类

好吧,这是一个超级超级菜鸟问题,我几乎不好意思问… 我想在我的XAML文件中引用一个类。 它是一个DataTemplateSelector,用于为DataGrid列选择正确的编辑模板。 无论如何,我已经将类编写到我的代码后面,将本地命名空间添加到XAML顶部的顶部,但是当我尝试从XAML引用该类时,它告诉我该类在本地命名空间中不存在。 我必须遗漏一些非常简单但我无法理解的东西…… 这是我的代码。 XAML: blah blah blah… C#: namespace CustomFields { public partial class MainWindow : Window { public MainWindow() { this.InitializeComponent(); // Insert code required on object creation below this point. } } public class RangeValuesEditTemplateSelector : DataTemplateSelector { public RangeValuesEditTemplateSelector(){ MessageBox.Show(“hello”); } } } 我有什么想法我做错了吗? 我认为这应该很简单,如1-2-3 …… 谢谢!

WPF MVVM从BackgroundWorker更新UI绑定属性

从Backgroundworker更新ViewModel的UI绑定属性是否存在任何潜在问题? 我正在尝试在绑定到UI时更新VM,并且可能用户可能正在键入…同步如何工作(我不认为我可以使用XAML中的Lock语句)。 提前致谢..

带链接的C#WPF文本

我刚刚发现自己面临一个新的挑战:使用像纯文本处理更像Web的字处理器。 为此设计一个很好的框架是我无法等待的开始,但我确实需要知道GUI端的可能性(它可能会有很多GUI挑战)。 所以基本的东西,我需要某种控制,我可以使我的文本的一部分可点击/鼠标覆盖。 我是WPF的新手,不知道如何做到这一点。 有谁知道如何制作这个? 有例子吗? 是否已经有控制权? 提前致谢 编辑: 我发现了一些使用richtextbox的方法: // Create a FlowDocument to contain content for the RichTextBox. FlowDocument myFlowDoc = new FlowDocument(); // Add paragraphs to the FlowDocument. Hyperlink myLink = new Hyperlink(); myLink.Inlines.Add(“hyperlink”); myLink.NavigateUri = new Uri(“http://www.stackoverflow.com”); // Create a paragraph and add the Run and hyperlink to it. Paragraph myParagraph […]

Kinect框架到达异步

我正在寻找Kinect v2 SDK中的MultiSourceFrameArrived事件的一些帮助。 以下是有问题的方法: private async void _reader_MultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e) { MultiSourceFrame multiSourceFrame = e.FrameReference.AcquireFrame(); using (var colorFrame = multiSourceFrame.ColorFrameReference.AcquireFrame()) { if (colorFrame != null) { _writeableBitmap.Lock(); colorFrame.CopyConvertedFrameDataToIntPtr( _writeableBitmap.BackBuffer, (uint)(_colorFrameDescription.Width * _colorFrameDescription.Height * _colorFrameDescription.BytesPerPixel), ColorImageFormat.Bgra); _writeableBitmap.AddDirtyRect(new Int32Rect(0, 0, _writeableBitmap.PixelWidth, _writeableBitmap.PixelHeight)); _writeableBitmap.Unlock(); reflectionOverlayControl.ReflectionImageSource = _writeableBitmap; } } using (var bodyFrame = multiSourceFrame.BodyFrameReference.AcquireFrame()) { if (bodyFrame […]

WPF添加datagrid图像列可能吗?

使用C#.Net 4.5,Visual Studio 2012 Ulti,WPF。 我有一些旧的win-forms代码,我想在这个新的WPF应用程序中做。 代码如下: DataGridViewImageCell pNew = new DataGridViewImageCell(); ParetoGrid.Columns.Add(new DataGridViewImageColumn() { CellTemplate = pNew, FillWeight = 1, HeaderText = “pNew”, Name = “pNew”, Width = 30 }); ParetoGrid.Columns[“pNew”].DisplayIndex = 18; 3行代码添加可以处理图像的列。 在WPF中,我看到它有点不同。 我需要添加“图像列”吗? 或者WPF列是否支持图像? 还是有另外3个线性解决方案,只是不同的语法? 谢谢你的帮助

在WPF中创建对角线模式

我想在WPF中创建对角线阴影图案。 我正在使用以下XAML代码来生成它: 但是用这种图案填充后的形状,我两条线之间的间隙越来越小。 谁能建议一种避免这种小差距的方法?

取消按键事件

我怎么能返回键?,意思是如果我只想在文本框中只允许整数值,我怎么能不允许用户不输入非整数,关于, KeyPress事件,我知道还有其他方法如表达式匹配字符串值,但我不想为文本框分配无效值。 if (( value >0 a&&(value <=9)) then assigned else return

无论何时在wpf中滚动任何一个ScrollViewers,都会同步滚动它们

我已经完成了这个主题: 将两个VerticalScrollBars绑定到另一个 它几乎帮助实现了目标,但仍然缺少一些东西。 这是左右或上下移动滚动条给出了我的两个滚动查看器中滚动的预期行为,但是当我们尝试在滚动查看器中滚动使用/单击这些滚动条末端的箭头按钮时,只滚动一个滚动查看器预期的行为。 那么我们需要添加/编辑以解决这个问题呢?