wpf

Define global textbox (or other control) width in WPF

I'd like to be able to maintain the width of controls globally throughout my WPF application. Previously in winforms world I'd override onload in a base form and iterate through all controls and containers and determine the type of controls and set the dimensions accordingly. I guess I could do the same in WPF but is there any better w...

wpf display staggered content

I am trying to display a rather dynamic list of data in WPF. I have essentially a LineItem class that contains a list of strings and a line type. The line type separates different categories of line items. All line items with the same type should be displayed the same and their data should line up. For example, this list will contain...

Is there a performance disadvantage for WPF''s Control properties?

I am learning WPF and it seems like some properties like Content are of type Object. When you have a very complex UI with 1000s of controls, would this be a problem with boxing, etc? I see that this provides a lot of power (having Content to take anything), but just thought I should ask people's opinions about this. ...

How to get the PrintDocumentImageableArea for a given PrintQueue without going through PrintDialog?

From MSDN (link): The type PrintDocumentImageableArea has no public constructor. Hence, the variable documentImageableArea must be declared and assigned to Nothing and only then passed to the method. This method displays a PrintDialog requiring input from the user. After the user has selected a printer, paper size, an...

Style Trigger on Attached Property

I have created my own Attached Property like this: public static class LabelExtension { public static bool GetSelectable(DependencyObject obj) { return (bool)obj.GetValue(SelectableProperty); } public static void SetSelectable(DependencyObject obj, bool value) { obj.Se...

WPF Beginner - A simple XAML layout not working as expected

Hi, I've just started learning WPF, and followed a book to make this sample calculator application in XAML. The XAML code is attached below. I don't have any UI specific code in the xaml.cs file. However, I'm seeing a difference between design time and runtime. As you can see in the attached screenshot, the upper left button of the cal...

User Control As Owner

I have window form in my WPF Application when I open new window from my form I used to set the owner of the new window to my opening window. But when I have converted the parent window to user control the line objSearchCareGiver.Owner = this; gives error Cannot implicitly convert type 'MyNameSpace.ucUserControlto 'System.Windows.Wind...

How to disable maximize button in a WPF appication page not in a window

I want to disable the maximize button in WPF application page, not in a WPF application window When I searched in Google, it is available methods for disabling the maximize button in WPF window The code snippet is as follows Window.WindowStyle= WindowStyle.None But is not working in WPF page It is showing errors. In WPF page there ...

WPF How to get window reference that is loaded from a page that is into it?

Hi! I have a page that is into a window similiar to MDI. I want to get the reference of the window in what the page is placed into. The window is loaded. Thanks. ...

Using Moq at Blend design time

This might be a bit out there, but suppose I want to use Moq in a ViewModel to create some design time data, like so: public class SomeViewModel { public SomeViewModel(ISomeDependency dependency) { if (IsInDesignMode) { var mock = new Mock<ISomeDependency>(); dependency = mock.Object; // this throws! ...

How to create a csv Excel file from content in a gridview in WPF?

Hi! I would like to export to a csv file the content of a gridview in WPF. Which is the best and efficient way to do it? Thanks! ...

Is there a way to do simple calculations in a xaml element binding statement other than using a converter?

In XAML I want to bind the height of one element to be half the height of another element. Is there a way to do this that doesn't involve writing a converter in the code-behind? Example:- What I've got... <Button Name="RemoveButton" Content="Remove Stage" Width="100" Height="{Binding ElementName=AddButton, Path=Height, Converter={Stat...

Building Visual studio like application, need inputs..

Hi, I am working on a Visual studio like application i.e. have a tolbox, an editor and property grid similar to VS. User can drag and drop the controls(custom and third party) to the editor window and perform operations like resize, move, align, group etc.; Properties of that control needs to be displayed in property grid and user can ...

WPF C# Gridview to datatable

Hi! I have a gridview into a listview and what I want is to convert gridview to a temporal datatable including column headers. How can I do this? Thanks. ...

Access SurfaceWindow from TagVisualization

Hi, I'm looking for an easy way to access my main SurfaceWindow from a TagVisualization that I have. The scenario is that I want to pass along data from my TagVisualization back to the SurfaceWindow. Is there an easy way to do this? Thanks ...

How to find version of WIC Windows Imaging Component

How to find version of WIC Windows Imaging Component. Is it shipped with OS like XP, Vista, etc. I am using WPF application having TIFF image, which is having some issues ie the image is showing black with certain height; someone on the forum suggested that it might be the issue with WIC version 1. Can anybody please tell me how to fi...

WPF: Displaying two windows simultaneously (extended desktop) in full screen

Hi, I just want to find out how to run two WPF windows (one in extended desktop) while in Full screen mode. ...

Howto bind a RoutedCommand in a child?

I am having trouble binding a Command that is generated up the UI tree to a control. The following example illustrates my point, the CommandBinding in Grid does not act on the InputBindings in Window. Maybe I do not understand the point of commands, but I would like to have a nice solution for child controls to act on user input on the W...

WPF Canvas Binding

Hey guys, I'm rather new to WPF, so maybe this is a simple question. I have a class that derives from Canvas, let's call it MyCanvas. And I have a class, MyClass, that has a property of type MyCanvas. In XAML, I built a TabControl, so each TabItem binds to a MyClass object. Now, in the Content of every tab I want to display MyObject.MyC...

Swapping data binding in code

I have two data-bound text boxes. One is bound to a string and the other to a number. The 'default' binding is set in XAML. Under some circumstances I need to reverse the bindings at runtime (the string is usually a prefix but sometimes it's a suffix). I have the following code in my view model, called when the window is loaded: Binding...