wpf

WPF: Align last TWO controls in StackPanel/DockPanel on the very right side

Thats my code so far which does not work: <DockPanel > <Button Content="Start" Command="{Binding Path=FirstDateCommand}" /> <Button Content="Back" Command="{Binding Path=PreviousDateCommand}" /> <DatePicker Width="150" SelectedDate="{Binding Path=SelectedDate}" ...

How to optimize this LINQ query for Visual Studio?

I have this one gigantic complex LINQ to SQL query that I need to optimize somehow, because the background C# compiler completely hogs the CPU and I can't type or edit my .cs file normally in Visual Studio 2010 (every letter, especially if IntelliSense wants to pop up, lags horribly). The culprit is this: var custFVC = (from cfvc ...

Unprecise rendering of huge WPF visuals - any solutions?

When rendering huge visuals in WPF, the visual gets distorted and more distorted with increasing coordinates. I assume that it has something to do with the floating point data types used in the render pipeline, but I'm not completely sure. Either way, I'm searching for a practical solution to solve the problem. To demonstrate what I'm t...

XBAP,System.Security.SecurityException ,how i can work out this?

Hi All i am doing a test to host my WPF app on the WEB with a Databinding but when i deply the file i receive this error: Startup URI: C:\Users\Mamma\Desktop\New folder (2)\WpfBrowserApplication1.xbap Application Identity: file:///C:/Users/Mamma/Desktop/New%20folder%20(2)/WpfBrowserApplication1.xbap#WpfBrowserApplication1.xbap, Versio...

Firing another event from one event ..

Hello.. i will try to be clear.. here i am working on a datagrid. in datagrid one column is editable as i am passing DataGridTextColumn to it and holding the data when users enter data into it and writing back to database. i am saving to database using datagrid_celleditending event also i am using the datagridcelleditendingeventargs to ...

Change WPF window background image in C# code

I have a couple of Images configured as application resources. When my application starts, the background of the main window is set via XAML: <Window.Background> <ImageBrush ImageSource="/myapp;component/Images/icon.png" /> </Window.Background> If a given event occurs, I'd like to change this background to another resource ("/mya...

WPF Binding TextBox Text Property to a specific ViewModel's Property in a TreeView

I have a TreeView which I have bound to a ViewModel called RootViewModel which has a collection of ViewModels ChildViewModel which has a collection of ViewModels GrandhChildViewModel. I have a text box next to the tree view. I want to bind the text box's text to a specific property of the selected item only when a GrandChildViewModel i...

WPF RichTextBox: save/load in custom format

I need to load/save data from the WPF RichTextBox in a custom format (similar to Markdown). RichTextBox supports saving/loading in several basic formats (Rtf, Text, Xaml) using TextRange.Save method: using (FileStream fs = File.OpenWrite(file)) { TextRange text = new TextRange(rtNote.Document.ContentStart, rtNote.Document.Content...

Cross fire with Messenger system between ViewModels causes Problems...

I have a DateNavigatorViewModel + DateNavigatorView on my ButtonBar. Below are 2 Views which get exchanged: DailyView and WeeklyView. Each View has a DailyViewModel and WeeklyViewModel. In my DateNavigatorViewModel I have messenger.Send(SelectedDate); In my DailyViewModel and WeeklyViewModel each register in the constructor: messenge...

How to get OnSelectionChanged ListBoxItem background change when modifying the data at the same time using a ListBox control ?

Hi, I have a ListBox control with an ObservableCollection instance as the control's ItemsSource property. Everything works fine, but when I handle the control's OnSelectionChanged, my business logic modifies the collection's data and I no longer get the ListBoxItem background change you usually get when your ListBox selection changes....

Binding StringFormat

I have a collection of textblocks that I'm going to be showing and I'm needing the text of each textblock to be displayed differently. I'm currently saving the format string in the tag property and I'm needing to display the text in this format. How do I bind the StringFormat section? Something like the section below: <TextBlock Tag="{...

Creating a dynamic grid control

Hi all. While working in WPF i have the need for a Dynamic Grid. By this i mean a grid that contains only one kind of object, has a template for that object etc. But unlike a similar ItemsControl like a Listbox, i want the grid to be given a Maximum Columns property. This should act as a delimiter which will then calculate the number of ...

A vertical Seperator control in a Menu, Toolbar, StackPanel, etc. - Is it possible?

I want to use the Separator control in a vertical way(Lets say in a horizontal StackPanel). Searching around I found this method but it doesn't use the Separator control rather it uses borders and rectangles. http://social.msdn.microsoft.com/forums/en-US/wpf/thread/eab865be-ad9b-45ed-b9d8-fc93f737b163 Is it possible to use the Separato...

wpf VisualTreeHelper.HitTest

I have a canvas and within it I have many Thumbs.. when I make a hit test on the canvas so as to find the thumbs near my mouse I get the wrong expected result which I get the border of the thumb not the thumb itself.. Please I want the solution!! ...

To show user that the video has ended in WPF

I need help! I'm facing a problem that is got to do with Slider + Tree View + Video. Using Blend and WPF, language C#. Header (a) sub header X << Play Video (a) only on click (b) sub header Y << Play Video (b) only on click Video (a) [Duration 0:00 to 0:09] and Video (b) [Duration 0:10 to 0:20] I have combined the Video (a) and V...

Implement faster graphics operation on WPF Canvas

Hi, I am trying to build a simple graphics application in WPF C#. The purpose is to draw 10000*10000 rectangles of size 4 pixels each. I have modified the OnRender method of the canvas to draw the rectangles. Drawings are performed for smaller number of rectangles (say 50*50 or 100*100 rectangles of 4 pixel each) but it is slowing down...

WPF Create Composite Control

Let's say I have 5 buttons aligned in a row, and the text on the buttons cycle when I click on any of them. I want to turn this into a single control, so that I can create more of these "5 button" controls with similar behavior. What would be the best way to create this sort of control, while still sort of preserving the control of the ...

Wpf datgrid itemdata bound event

Hello All i have a problem i have a wpf data grid Which have a textbox Column and one item templatecolumn (Radio button) i want this radio button on My Codebehind i m unable to find item data bound event in Wpf is their any similar event have in Wpf thanks in advance shashank ...

WPF and Localization...

Hi, I've a quite obvious problem. Here's the situation: - my WPF application is primarily written in German - I've to use resx-files (standard way in the company) - the fallback-language must be English. - the german resources are the base for all translations (including English) I've tried many combinations with "[assembly: NeutralReso...

Real-time WPF chart .Net 4

Hi, I'm working on a diagnostic tool and receives data every 25 ms. I need this data to be drawn in my chart using a lineSeries. I'm using a a wpf chart with a lineSeries which I bind in xaml to an ObservebleCollection. The problem is that I need the collection needs to contain atleast 1600 datapoints before starting to remove them at t...