wpf

Designer rejecting DataTemplate.DataType

I am try to fit some WPF into my current Windows Forms application. When I use this simple user control, the designer for that control does not reload. This only happens in this application. If I make a clean Windows Forms project, add these files, the designer works fine. I have tried a reload of Visual Studio, and cleans / rebuilds o...

Loop through UserControl in WPF

Hey, I was wondering if it was possible to loop through several WPF controls. So lets say I have a control that I want rendered (with different data each time) 10-20 times depending on what it has. The only alternative I found was to manually create 20 of these user controls and hide the ones I was not using. Is it possible to loop th...

How do I loop through all the controls in a window in WPF?

How do I loop through all the controls in a window in WPF? ...

Why does my converter giving an invalid cast error?

I created a Converter to convert from double to integer. But the line "return (int)value;" always gets a "specified cast is not valid." What do I have to do so that my Converter successfully converts a double and sends back an integer? Converter: namespace TestChangeAngle { [ValueConversion(typeof(double), typeof(int))] class...

WPF Data Binding to external data model

Hello, I've recently started develping an application using WPF and I'cant really wrap my mind around following thing: I have a Domain Model of my application which is simple POCO objects serialized to/from harddisk. Then I have the WPF application and I'd like to bind it to various parts of the model. I need to be able to notify UI o...

sharing WPF ControlTemplates

I'm trying to learn more about WPF. I ran through an online tutorial that created a button and then created a template to be applied to additional buttons. The problem is this template is in the Window.xaml and I can only access the template from within that application. How do I make the template more globablly available? I'm thinking o...

WPF Application - Visual Studio 2008 Toolbox Not Loading Correctly!

Hello, I'm pretty new to WPF however i've got a solid understanding of WindowsForms. When I create a new WinForms application in Visual Studio the Toolbox displays a huge list of different controls that can be used for developing the program. However, this is only the second time i've started to design stuff in WPF and the toolbox is l...

WPF Binding to a Combo using only a subset of a Collection's items

I'm trying to set a TwoWay binding to a combo box using only a selection of a collection's objects. Currently, everything works out ok if I just want to bind everything in the colelction, but in the example class below, what if I only want to show items where Active=True? I can filter the items using LINQ like ItemsSource = FROM x IN Col...

WPF DataGrid - Combining TimeSeries w/MultiBinding, lose change-notification. Why?

Hi all, I have a class that has two ObservableCollection< TimeValue >'s, where TimeValue is a custom DateTime/Value pairing with change-notification (via INotifyPropertyChanged). I call these Targets and Actuals. When I bind these to a chart, everything works perfectly, and I get two LineSeries. If I bind one of them to a DataGrid, wit...

Open PDF file in RichTextBox in WPF

Can I open a PDF file in RichTextBox? ...

treeview selected item should highlight with some color

I have a treeview in wpf. I want a different color when i select the treeviewitem. Any Suggestions Plz.. Thanks ...

WPF Virtualizing a Canvas

We have a series of rectangles produced inside a Canvas and they are nested in this order ScrollView>Canvas>VirtualizingStackPanel>Rectangles in the XAML. There seems to be little information on Microsoft about under what senarios Virtualization is supported, and in cases where it isn't no error is thrown, it merely treats it like a sta...

What is the difference between loading Pages or UserControls into a XAML Frame Element?

I'm rebuilding a WPF slide-show application structure that I found in the downloadable code for this WPF video. There is a Presentation class which has an INotifyPropertyChanged property "CurrentSlide" which changes as you click next/previous buttons and is displayed dynamically in a Frame element. The downloaded code loads Pages into...

In WPF, how do I adjust the scroll increment for a FlowDocumentReader with ViewingMode set to Scroll?

Hi I'm displaying a FlowDocument in a FlowDocumentReader with the ViewingMode="Scroll". If I use the wheel on my mouse, the document scrolls very slowly. I'd like to increase the scroll step. I've tried to change the Scroll setting of my mouse in Control Panel, but that doesn't have any effect. I think that WPF ignores that setting f...

Populate ComboBox in GridView header with column data

I want to have a combo box in the header cells of my GridView (currently inside of a ListView) populated with the data from that column. To be used a bit like the 'auto filter' feature in Excel. The problem I have is I can't get to the data for the column from inside the header cell. At the moment, I have something like this: <Grid> ...

Is there a way to get a property value of an object using PropertyPath class?

I want to get a value of a nested property of an object (something like Person.FullName.FirstName). I saw that in .Net there is a class named PropertyPath, which WPF uses for a similar purpose in Binding. Is there a way to reuse WPF's mechanism, or should I write one on my own. ...

I have 2 listboxes with images. i want to hide the image of first listbox when i use that image in second listbox

I have 2 listboxes with images. i want to hide the image of first listbox when i use that image in second listbox. and also i want to know the nooftimes that i added image to the second listbox. In the second listbox image should show count of that image(on the image itself) no of images that image added. Any suggestions.. Thanks in ad...

How can I define a variable in XAML?

I have the following two buttons in XAML: <Button Content="Previous" Margin="10,0,0,10"/> <Button Content="Next" Margin="0,0,10,10"/> How can I define "10" to be a variable so I can change it in one place, something like this: PSEUDO CODE: <variable x:key="theMargin"/> <Button Content="Previous" Margin="{Vari...

autoupdate a list in wpf

Hi, I want to display a bunch of Objects i have created in a ListBox. My objects implement the INotifyPropertyChanged Interface. I tried to use an ObservableCollection, which i have bound to a listbox Control (listbox1.DataContext = MyCollection) But this does not exactly what i want to do, because the Listbox is not refreshed when one o...

Saving state in a WPF application

I am developing a WPF application with a treeview. I have Treeview like windows. Now what I want is if select I the treeviewitem, let's say... +Desktop | +---My Computer | +---C:\ | +---Some Folder. I selected the foldername called Some Folder in c drive. After that I close the application. When I open the app...