wpf

WPF MultiBindings in C#

Hello, I need to implement MultiBindings in C# directly without using XAML, I know how to use the IMultiValueConverter in C#, but, how to do: <MultiBinding Converter="{StaticResource sumConverter}"> <Binding ElementName="FirstSlider" Path="Value" /> <Binding ElementName="SecondSlider" Path="Value" /> <Binding ElementName="ThirdSli...

WPF databinding, ExpandoObject

Hi there I'm trying to databind to an ExpandoObject. I'm getting the following error: System.Windows.Data Error: 17 : Cannot get 'Dimension2' value (type 'Object') from 'Dimensioner' (type 'ExpandoObject'). BindingExpression:Path=Dimensioner.Dimension2; DataItem='Bogføringslinje' (HashCode=10586695); target element is 'TextBlockCombo...

WPF Toolkit DataGrid - rows overlapping (row height problem)

Hi, I have a DataGrid with some template columns that contain another DataGrid. My problem is that if some rows have a lot of content in them their height doesn't adjust so the whole content is visible, but rather it's cut off, giving the impression that the rows overlap. However, as soon as I add a new row to the grid or add a new row ...

StockTrader RI > Controllers, Presenters, WTF?

I am currently learning how to make advanced usage of WPF via the Prism (Composite WPF) project. I watch many videos and examples and the demo application StockTraderRI makes me ask this question: What is the exact role of each of the following part? SomethingService: Ok, this is something to manage data SomethingView: Ok, this is ...

C#/WPF Retrieving images from database and displaying them

Hi, I need to retrieve the url of the image from the database, bind it to a business object, convert it into a bitmap image and map it into the resource dictionary. The resource dictionary is used as a library and I cannot change it. The database consists of one table that has three columns: id, name, url. It is the SQL CE 3.5 local dat...

wpf combobox selecteditem to null after onsourceinitialized

I have overrided the method OnSourceInitialized and I have one problem. After populating my combobox with source property from c# code I want automatically an item will appear selected in the combobox when a page is loaded (default value) but for some reason after onsourceinitialized method, the combobox selected item change to null. ...

Problem with WPF validation(IDataErrorInfo) and tab focusing.

I have a TextBox bound to a property of an object which implements IDataErrorInfo. I set up the Validation.ErrorTemplate of the TextBox, and it works fine. The problem is that i have these on a TabControl, and the validation template doesn't display any more if i change the tab to another one and then come back to the initial tab (where...

Why would WPF / Entity Framework give me a AspNetHostingPermission error when reading .MDF file?

I have a WPF application which uses LINQ-to-SQL to access an .MDF file within its local directory structure. This works fine. However, when I create a second .MDF file in the same directory as the first, and try to create a model with Entity Framework, it gives me this error: Request for the permission of type 'System.Web.AspNetHo...

Should I use WPF or Winforms to build my new Windows desktop application?

There are pros and cons for both approaches. But from a managers perspective what is the best approach? ...

How to set up Avalon docking manager to resize like VS?

Hi I am using Avalon in my WPF app. I want a window similar to that of Visual Studio, Tools on the left, then the documents in the middle and the Properties on the right. I managed to do that with this code: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="ht...

Display Exception in WPF XBAP

I am extremely new to WPF and I'm using XBAP to create a drag and drop application for a company Intranet. I have pretty much everything working, but I am getting an exception (I presume) but the exception isn't displaying. I'm in a debug environment but it doesn't seem to be making a difference. How can I see the exception which is b...

WPF DataTemplate not throwing exception

While designing a new WPF application I noticed exceptions not being thrown during data binding for controls with DataTemplates. To test I wrote the following simple user control with as little logic as possible. I'm using .NET 3.5 SP1, VS2008 SP1 running on WIN7. When the DataContext is set, TestMethod is called and an exception is t...

DataTriggers in Expression Blend

I have a listbox that displays Shipment Items (custom class) that are formatted using a datatemplate (see below). There is a border element in the template (I am calling it a Gem) that displays which item is active (not selected) which will be the item to which products will be added. template.png There is a boolean property in the sh...

Best practice for forwarding ItemsSource

I have a UserControl that contains - among other things - a ListView. The ListView has a different data context than the UserControl (this data context is not exposed). If someone consumes my control, I would like them to be able to (indirectly) bind to the ListView's ItemsSource dependency property. It should really feel like the use...

Color picker image created programmatically .NET?

Do exist any algorithms to create programmatically images, for use then a base for a color picking control? If you know some useful sources for document or code about this topic they are welcome. EDIT: my idea is to create a WPF Picker Control, I know there already some for WPF, Sacha's one, or the one from Microsoft Sample. The point ...

WPF or WinForms for occasional programmers?

I'd like to move my project's ActiveX controls to (preferably) WPF or WinForms. My customers aren't expert .NET programmers, but they're able to use WinForms to do basic drag-drop to use my controls. I've experimented with the VS 2010 WPF designer, and it seems like the drag-drop experience is much less intuitive than WinForms. Is i...

Is there a better way than a grid to line up controls in WPF?

I am using a grid by the definition of appropriateness defined in this question Grid vs Stackpanel. However when working with grids you have to define the controls position inside them explicitly in the grid. This becomes a pain when having to reorder controls or when adding a new control to the grid. With the code provided as an example...

WPF definition of FontSize

I know that in WPF, FontSize = 1/96 of an inch (same as 1 pixel I think). Is the FontSize dimension the height, the width, or diagonal size of a character? I would guess it's the font height, but the Microsoft documentation doesn't really indicate what it is. Also, is there an easy way to get the height and width of a font size? Answ...

WPF DataTrigger not firing outside of ItemsControl

I have a Custom UserControl that extends the button control and adds two new dependency properites IsActive and Icon. In the control there are DataTriggers that set the Icon and the Active state based on the value. The issue I am having is that the control only working inside of an ItemControl. Here is the XAML portion of the contro...

C# WPF Drag to Reorder Listview

How would I drag to reorder a ListView in WPF? ...