wpf

WPF Composition/Agregation

Hi, I'm looking for documentation regarding WPF best practice for Compositing and agregating the user interface in a large project. I'm comming from a visual Inheriance world using Delphi and Winform. And I'm now try to replicate that kind of pattern well in fact reusability of those UI elements. I'm open to suggestion and reading. ...

Binding an Image source to TextBox.Text

I am trying to bind the Text of a TextBox named 'txtImage' to an image using the following code with no results: <Image Source="{Binding ElementName=txtImage, Path=Text}" /> What would the right approach be? ...

Can I dynamically switch between styles in WPF?

Let's say I wanted to display a Button and a few RadioButtons. Based on which RadioButton is selected, I want to apply a different style to my Button. Is this possible in WPF? ...

WPF/XAML - Scaling text size to window size

I'm new to WPF. I have a WPF Window with a bunch of Labels on it as well as a ListBox. When resizing the window, I want to scale the size of SOME of the Labels, but not all of them. I don't want the ListBox to scale either--just some Labels. I understand I can use a Viewbox to resize as the Window resizes, but as much as I mess with ...

Binding to the Current Item (WPF)

I am attempting to bind a ListView control to a DataTable, but the WPF binding system seems to be complaining about the binding path I specify. As an example, a GridViewColumn is defined as follows: <GridViewColumn Header="ColumnTitle" DisplayMemberBinding="{Binding Path=/, Converter={StaticResource myConverter}}"/> As far as I under...

wpf binding combobox to enum in different namespace

I'm trying to bind a XAML ComboBox so that its list items are the members of the System.IO.Ports.Parity enum. I've found plenty of examples of databinding enums, but it seems these don't work if the enum is in a different namespace (like System.IO.Ports). Right now I have: <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Ty...

.Net Winforms/WPF Editor that generate HTML

Looking and .Net Rich Editor that generates HTML, it is important to be capable of handling Tables, merging Cells among other table stuff. ...

XAML x:Name on code

Ok, the problem is that I have a few GridViewColumns, which don't implement a Name property, but, I can always of course set the x:Name property to them. How ever, I need to get them by this name on code, sort of like foreach(GridViewColumn column in this.ColumnCollection) { if(column.(x:Name Property) == "columnName") retur...

WPF ListBox Button Selected Item

I have a listbox with some textblocks and a button -- in the button's codebehind it calls a method passing the currently selected listbox item, this works great. The issue is that when I select an item and then click the button on another item it doesn't update the "SelectedItem" property -- is there a way Xaml or C# that I can force a b...

Dynamically xaml file's code-behind externally?

I've been writing applications that load xaml files dynamically using XamlReader. That way I can skin my applications in different ways, or distribute just simple xaml files to users for different amounts of functionality. Now I'm wondering if there's a way to do something similar for code-behind files. Is there a way to distribute a loo...

Hosting browser in WPF

Is it possible to host any other web browser beside IE in WPF desktop application? Edit: If yes, how? ...

Dynamically added DataTemplate - StaticResource for Converter can't be found

Hi, I'm using the following code to dynamically add columns to my GridView: public void AddGridViewColumns() { GridView view = (GridView)_myListView.View; GridViewColumn column = BuildGridViewColumn(1); view.Columns.Add(column); } public virtual GridViewColumn BuildGridViewColumn(int blockIndex) { string templateXaml = ...

Handling System Shutdown in WPF

How can I override WndProc in WPF? When my window close, I try to check if the file i'm using was modified, if so, I have to promt the user for "Do you want to save changes?" message, then close the file being used and the window.However, I cannot handle the case when user restarts/shutdown/logoff when my window is still open.I cannot ov...

Why is only half of my label displayed? [WPF]

I have a grid in a WPF window, and that contains a label in its first column. I have applied a SkewTransform for the label. If I reduce the column width the label is displayed half Screenshot I'm expecting it to display Prashant, my main aim is to reduce extra white space next to the label XAML Code <Grid ShowGridLines="True...

WPF DataTemplateSelector.SelectTemplate not called for a ContentControl-derived type

I'm trying to build a ContentControl-derived control (let's call it MyContentControl) that will have its ControlTemplate set by an instance of a DataTemplateSelector-derived type (let's call it MyTemplateSelector). When I try to this: ContentControl contentControl = new ContentControl(); contentControl.ContentTemplateSelector = new MyT...

WPF ListBox fixed width

I have a ListBox in a PopupControl. Problem is that while scrolling, Popup resizes to fit the actual widest element. How to avoid this resizing and adjust automatically to the widest element in the whole list? I tried to put it in a Grid but without succes. ...

WPF Chart binding error

Hi, i have problem to correctly bind data to WPF Chart. When i'm setting ItemsSource i get error: Assigned dependent axis cannot be used. The data may not be able to be rendered on the provided axis or the series may require that they axis has an origin. oc = new ObservableCollection<Pair>(); heartBeats.ItemsSource = oc; to P...

Why the WPF/RotateTransform uses so much CPU?

Steps to reproduce: Create a new solution/add new WPF Application project. place just a canvas in the main window. create a RotateTransform + PageUp/Down events for incrementing the angle with +-10. place 50 polygons on the canvas Press PageUp/Down (and keep pressed) On my PC the CPU usage is 80%. Now try placing 1000 polygons and ...

Using IDataErrorInfo and setting Validation.HasError style

Hi, In WPF using IDataErrorInfo and Style I want to create form where I can provide end user three different status while validating data To make scenario more clear 1) I have textbox next to it I have icon which provides end user what kind of input textbox expects - Initial status with information icon 2) As soon as user enter data ...

How to publish an event in my module's constructor?

When I try to publish an event in my Customer Module, it doesn't work (the subscriber does not receive the object, displays nothing): public class CustomersRegister : IModule { private static IRegionManager regionManager; private static IRegion region; private static CustomersMainView view; private s...