wpf

XAML:The attachable property VisualStateGroups was not found in type VisualStateManager

I'm using VS2008 EE SP1 + WPF + XAML. In the beginning I added a reference to it: xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" I'm getting this error while compilation: <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualStateGroup.Transi...

WPF convenience controls

Hi Guys I asked this question the other day. I got only one answer which was to make my own control and add a dependency property to vary the only thing that changes (an index to get the right data bindings in this case). If that's the only way to do it though, it raises some other questions. Specifically, if you find yourself wantin...

SubreportProcessing Event not Firing

I'm using rdlc reports in WPF, so have done so using WindowsFormsHost wrapper. The rdlc report I'm looking for run has a subreport embedded in it, and I'm setting the data source of that using the SubreportProcessing event of the ReportViewer. Viewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LoadAccessories...

What is the way to minimize number of similar event handlers?

A WPF window should have hundreds of objects (rows of rectangles) and mouse clicking on each of them should fire similar actions. These actions differ only by several parameters (say "No. of Row" and "No. of position in a row"). Should I have hundreds of almost the same event handlers or how I could optimize my code? Please give me som...

WPF Data Binding - Data Template is not Getting Values

I have the following DataTemplate: <DataTemplate DataType="{x:Type Client:WorkItem}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <Co...

Unity Configuration and Same Assembly

I'm currently getting an error trying to resolve my IDataAccess class. The value of the property 'type' cannot be parsed. The error is: Could not load file or assembly 'TestProject' or one of its dependencies. The system cannot find the file specified. (C:\Source\TestIoC\src\TestIoC\TestProject\bin\Debug\TestProject.vshost.exe.config li...

WPF - ScrollView Confusion

I am new to WPF and the ScrollViewer is frustrating me. Either I just don't "get" it, or it is a limited control. Here are my Frustrations: Bad Horizontal Scrolling The horizontal scroll bar is only visible at the bottom of the list (I have to scroll to the bottom to see it) Bad Borders I have a ListBox in my ScrollViewer. When I st...

How can I download a file from an untrusted secured site in a WPF application?

I have a file on a secured site I would like to download using a WPF application. The file is a tab delimited text file at a URL of the form https://my.server.com/test/my%5Ffile.txt. Here is the code that I have so far: Uri uri = new Uri("https://my.server.com/test/my_file.txt"); System.Net.WebClient client = new System.Net.WebClien...

How do I select an item in my WPF ComboBox based on my data binding?

I've got my DataContext set to a Book object. Book has properties: Title, Category. I've got a CollectionViewSource "categoryList" that holds a list of Categories. Question: How do I select the book's Category in this combobox? <TextBox Text="{Binding Path=Title}"/> <ComboBox SelectedValuePath="Id" SelectedValue="{Binding...

wpf combobox selected item

I have a wpf app with a combobox like this <ComboBox name="cmbBx1"> <ComboBoxItem Name=Jan">January</ComboBoxItem> <ComboBoxItem Name=Feb">February</ComboBoxItem> </ComboBox> In the code behind I need to get the value of the item that was selected to pass to a stored procedure. I can get part of the way by doing this: ComboBoxIt...

How to correctly pass some custom parameters to event handlers in WPF?

What could be a correct way to assign parameters to objects in WPF window (objects as simple as rectangles) and pass them to event handlers on mouse clicks? Thank you. ...

Seeking guidance on WPF Prism Multi display application

Hello all, I'm in the beginning stages of designing an application using Prism and have a question. In all the reference material I've been able to find, there is lots of details on creating a single screen application, but I have a requirements beyond that. I would like the have two windows showing (Multi screen), both with the exact ...

Getting a list of loaded modules from PRISM in WPF

I have a WPF application built on top of PRISM. When the user tries to close the application I need to check the dirty status of any loaded views. I was hoping to enumerate a list of the loaded modules and ask them in turn whether it's OK to exit and save any changes, but I'm having trouble finding a list of references to the loaded mo...

Click and drag selection box in WPF

Is it possible to implement mouse click and drag selection box in WPF. Should it be done through simply drawing a rectangle, calculating coordinates of its points and evaluating position of other objects inside this box? Or are there some other ways? Could you give a bit of sample code or a link? ...

How can we align different line with different alignement in FomattedText .

I have to draw formatted text in such a manner that last line should always come with right align. for example. "Some text ............................................................" Right align. I can set font size etc in formatted can i set text like it always come in next...

WPF IDataErrorInfo multiple field validation

What is a good way to integrate multiple field validation with IDataErrorInfo? Let say that I have a dialog with 3 textboxes for ftp information URL Username Password I have put the Required attribute on the fields (assume a normal TextBox for the password). I validate the ftp connection when the user press "OK". At the moment I sh...

WPF Custom Control Design question

Hi ! I have a design question: If you had to make a WPF Combobox with search support, (= combobox that shows a popup with some Buttons, Search TextBox, List.. etc the selected item feed to the default's ComboBox TextBox.) What would you do? Write a custom control (diretly inheriting from System.Windows.Control) Write a custom control ...

How to display percent-values using ContentStringFormat?

Greetings to the enlightened ones! I'm playing on this for several hours now, but wasn't successful (perhaps because I'm quite new to WPF): I have a DataGrid whose DataContext is bound to a DataTable. The DataGrid is of fixed size and its purpose is to hold a value table y(x) (i.e. the headers show the x-values and the corresponding y-...

Slow hyperlinks in wpf??

I have an app that is similar to a chat application. It also creates hyperlinks in many situations, which are added to the inlines of a TextBlock. The problem is, once I reach a few dozen hyperlinks, the mouseovers become horribly slow! It takes several seconds to change colour, and CPU usage shoots to 100%. I tested this out with a v...

Building a WPF Application with XAML through msbuild

I am attempting to build a simple WPF Application using msbuild via a custom script (below). The project builds and executes fine through Visual Studio, however if I use the msbuild script it builds successfully, and generates the executable, but crashes immediately on startup (with a "WPFApplication has stopped working" error message). ...