wpfRelated issues-Collection of common programming errors
devuxer
c# wpf image image-processing
I wrote a little utility class that saves BitmapSource objects to image files. The image files can be either bmp, jpeg, or png. Here is the code:public class BitmapProcessor {public void SaveAsBmp(BitmapSource bitmapSource, string path){Save(bitmapSource, path, new BmpBitmapEncoder());}public void SaveAsJpg(BitmapSource bitmapSource, string path){Save(bitmapSource, path, new JpegBitmapEncoder());}public void SaveAsPng(BitmapSource bitmapSource, string path){Save(bitmapSource, path, new PngBitmap
svick
wpf xaml data-binding
I created a ViewModel and bound its property to two textboxes on UI. The value of the other textbox changes when I change the value of first and focus out of the textbox but I’m not implementing INotifyPropertyChanged. How is this working?Following is XAML<Window x:Class=”WpfApplication1.MainWindow”xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”xmlns:local=”clr-namespace:WpfApplication1″Title=”MainWindow” Height=”350″ Wid
Ladislav Mrnka
c# wpf wcf entity-framework self-tracking-entities
This is a general architecture question, hopefully to folks out there already using EF in final applications.We have a typical N-Tier application:WPF Client WCF Services EF STE DTO’s EF Data LayerThe application loads all known business types during load time (at the same time as the user logs in) then loads a very large “Work Batch” on demand, this batch is around 4-8Mg and is composed of over 1.000 business objects. When we finish loading this “Batch” we then link everything with the previousl
Sunil
wpf popup contextmenu
I have a simple popup control which i want to use in my wpf application for contextmenu but its isOpen property is always showing false and my poup is not showing. I tried changing it in xaml as well as through my code but all in vain. Can anybody tell me why this unexpected behaviour is happening?<Grid><StackPanel><Popup x:Name=”contextMenu” IsOpen=”True” StaysOpen=”False”><Grid><Border BorderBrush=”Black”BorderThickness=”2″CornerRadius=”3″Background=”AliceBlue”>&l
Towhid
wpf listview combobox wpf-controls
I have populated a ComboBox inside a ListView. Screen shot is given belowAs shown above it’s displaying “M”, “a”, “c” instead of “Mac”. Why it is separating the word into characters?In code behind file I’ve writtenItemCategoryDAL itemCategoryDalObj = new ItemCategoryDAL();DataTable dataTable = itemCategoryDalObj.GetAllItemCategory();listView1.ItemsSource = dataTable.DefaultView;And in .xaml file I’ve written:<ListView Height=”148″ HorizontalAlignment=”Left” Margin=”23,12,0,0″ Name=”listView1
Francesco De Lisi
c# wpf multithreading sockets
In my MVVM View some buttons show blink reaction to Server get status response. A single button sends a sync socket request on mouse down and a sync socket request on mouse up with incremental ID on each message sent. On receive my client check if the response ID is the expected discarding the unexpected. Pressing multiple times a button in few millis increments the outgoing message ID too fast and the server responses are misaligned.To fix this misalignment we set a lock, not only on the socket
yu_ominae
c# wpf listbox contextmenu
In WPF I am trying to put a context menu on the items of a listbox. When I run my app and right click on an item of the listbox the menu pops up for a split second and then closes again. I just can’t figure out what I am doing wrong.This is the code I am using:<ListBox Grid.Column=”0″ Name=”lsbAddedElements” Width=”150″ Margin=”3,3,3,3″SelectionMode=”Multiple”><ListBox.ItemContainerStyle><Style TargetType=”ListBoxItem”><Setter Property=”ContextMenu”><Setter.Value>&l
Jason Dorell
.net wpf
I have a WPF dialog and I’m receiving the following error when I try to re-show the dialog after an exception is thrown…”Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed.”I’ve done some reading around the problem and this message usually appears if you try to re-show a closed dialog, but I am not reusing the dialog…Dialog dialog = new Dialog(); Exception exception = null; IDisposable disposable = this.subject.Subscribe( b => {di
Motig
c# wpf mvvm collections ninject
While developing a WPF application with Ninject I analyzed there are some collections that should exist only once in the code.For example, the Main Window consists of a inner list of project tabs, something like tabs in a browser. The main window’s view model contains this property ObservableCollection<ProjectViewModel> …and my idea was like, hey, there is one and ONLY one ObservableCollection of ProjectViewModel. What happens if I bind such type as a singleton with Ninject? So I wrote s
devuxer
c# wpf bitmap
The only way I found so far is System.Drawing.Bitmap.GetPixel(), but Microsoft has warnings for System.Drawing that are making me wonder if this is the “old way” to do it. Are there any alternatives?Here’s what Microsoft says about the System.Drawing namespace. I also noticed that the System.Drawing assembly was not automatically added to the references when I created a new WPF project.System.Drawing NamespaceThe System.Drawing namespace provides access to GDI+ basic graphics functionality. More
Web site is in building