wpf

WPF ScrollViewer: Horizontal scolling doesn't work

Why won't this support horizontal scrolling? <ScrollViewer> <ItemsControl ItemsSource="{Binding Territories}" HorizontalAlignment="Left"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel CanHorizontallyScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollV...

WPF Datagrid with variable number of columns AND change background color depending on value

Hi, I'm trying to make a grid that represent bookings over a month(excel style). For this I have used the WPF Datagrid and defined my column in C# code: for (int i = 0; i < noOfDaysInMonth; i++) { DataGridTextColumn tmpColumn = new DataGridTextColumn { Header = (i + 1).ToString(), Binding =...

Why WPF UserControl's performance is so difference host into Wfp application and win form application?

This is my question: 1.I have 200,0000 Employee object(Id,Name,Job,Address) store at a database. 2.I read all Employee object to Empolyee[]. 3.I create a window form application (1) I create a WPF UserControl(inside ListBox),name is "wpfUserControl1". (2) I put "wpfUserControl1" into a window form. (3) I set wpfUserControl1.listBox...

How to use Fiddler to debug traffic from Any app (eg. C#/WPF app)

I am tring to debug whats wrong with my HTTP requests from another question here on SO. So i read abit about Fiddler and wanted to use it to debug my problem. But I cant seem to get traffic from my WPF application to go through Fiddler. I believe I need to configure a proxy. I am using a WebClient for a basic example, but I think i will ...

what is the difference between TwoWay databinding and ObservableCollection?

Hello, As i was reading about ObservableCollection i came to know that it implements INotifyPropertyChanged which means whenever the view changes it's underlying collection also gets updated automatically which is exactly what is the purpose of TwoWay databinding. So, what is the difference between ObservableCollection and TwoWay databi...

Troubleshooting WPF / Silverlight XAML databinding ?

Whenever I am doing XAML, I tend to run into problems with databinding. It is often small issues, such as misspelling a property name. My problem is, that I don't seem to receive any errors or warnings when I am trying to bind to a property that does not exist. It would be nice to get a warning, either at compile or runtime, about my e...

how to read xaml from assembly

Hi, To navigate to a specific page in the assembly, the typical code looks like: NavigationService.Navigate(new Uri("pagename.xaml", UriKind.Relative)); I was wondering if there is a way to read the contents of this XAML file or may be a way to decompile the embedded BAML file from the assembly directly. ...

Problem with updating ListBox control in WPF

I have an application which has to monitor 211 rods, and every 5 seconds it will update 2 ListBox controls, each one containing either the inserted rods or the removed ones. When I manually use the button for inserting/removing rods the code executes perfectly and the ListBoxes update properly. When I use the global button which inserts ...

WPF RichTextBox: Disable Dragging Text within , Allow Dragging Text outside

Hello, I have a UserControl with a RichTextBox in it. It must be disallowed to drag/drop Text within the RichTextBox so the user can not change the visible sort order of the strings in the RichTextBox. But... it must be allowed to the user to drag/drop Text outside the UserControl to the same kubd if the UserControl. Is that somehow p...

Binding Between elements inside DataTemplate

Hello, How can I make binding between properties of two elements inside dataTemplate ? example : // Bind Text property to Content property <DataTemplate> <TextBox Text="{Binding}" /> <Label Content="{Binding}" /> </Datatemplate> ...

I can't animate a custom property in WPF

I've been struggling with this for hours and I can't find out what I'm doing wrong. Please help me find my mistake. I created a user control with one custom dependency property and I want to animate this property. Here is my class: public partial class UserControl1 : UserControl { public UserControl1() { InitializeComp...

Not able to use XAML extracted from Adobe Illustrator in WPF

I've created a design in AdobeIllustrator. Then I opened design in Microsoft Expression Blend, and got entire XAML code of the design. I tried to apply the XAML and create custom button with the same shape as in my original design. This is what I did: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ...

Provide value on 'System.Windows.Data.Binding' threw an exception

I am adding a validation rule to a textbox (following examples on WPF 4 Unleashed by Adam Nathan) When starting an application, I am faced with the following cryptic error message Provide value on 'System.Windows.Data.Binding' threw an exception What does the error mean and what needs to be done to address the problem? Here is...

Wpf flowdocumentReader page turn effect.

Hi, I am working in a very crucial wpf project.This project is almost finished apart from some points. I am showing flowdocumentreader which is loaded with dynamic images around 100. I have one requirement to show page turn effect whenever user navigates to pages in flowdocumentreader. I have used google and seen lots of example bu...

In WPF, how do I right justify menu items while keeping keyboard shortcuts?

I recently changed my XAML in order to gain the capability to right-justify menu items such as setting font sizes in the below graphic: File Configure Help +-------------+ +----+ | Font size > |->| 8 | | Speed > | | 10 | +-------------+ | 12 | +----+ Obviously, based on that gr...

How to inherit from ListViewItem in WPF ?

I need to create table that all ListViewItem of this table will be build hold 1. Image 2. Text 3. Button How can i do it ? ...

How to get the height of the title bar of the main application windows?

I'm using prism to load views to region. The problem is the loaded view overlapped the title bar of the main windows - the bar contains caption, close/minimize/maximize buttons. How can I get the title bar's height? Prefer to get it right in the xaml codes. ...

Finding all Images in a FlowDocument

Hi Since I am pretty new to WPF FlowDocuments I would like to ask if the code below is correct. It is supposed to return all Images contained in a FlowDocument as List: List<Image> FindAllImagesInParagraph(Paragraph paragraph) { List<Image> result = null; foreach (var inline in paragraph.Inlines) { var inlineUICont...

Is there a Threadsafe Observable collection in .NET 4 ?

Hi, Platform: WPF, .NET 4.0, C# 4.0 Problem: In the Mainwindow.xaml i have a ListBox bound to a Customer collection which is currently an ObservableCollection< Customer >. ObservableCollection<Customer> c = new ObservableCollection<Customer>(); This collection can be updated via multiple sources, like FileSystem, WebService etc. To ...

Selecting Datagrid Row when Right mouse button is Pressed

How can i select the WPF datagrid row when i click the right mouse button. I need to show the context menu in the datagrid but i am able to generate the context menu but selected row i not changing. How can i solve this issue. ...