wpf

WPF Multithreading...

I am building a WPF application that calls web services and displays the data returned from the service after being broken down and analyzed by my application. The problem that I am facing is with multithreading. One of the API calls is made using a DispatcherTimer every 60 seconds. The issue is that when this event fires, it blocks t...

How can I instantiate WPF elements via their type when they have StaticResources?

I need to instantiate WPF types (say, a UserControl or a Page) via reflection for a designer. The problem I'm having is that when I attempt to instantiate these using Activator.CreateInstance I get a TargetInvocationException which wraps, in the end, an exception thrown by the StaticResource markup extension. Clarification: The types ...

Need help with TabControl.ItemTemplate

Hello. How do I set the TabItem.Header to bindings taken from few fields, each binding shown in a different size, all in the place of the original header text; without overriding the default style and behavior of the header - I only need the text. I tried to set its template but then it creates a rectangle that contains the inner contr...

WPF PreviewKey fails on application switch

I have a WPF application that makes use of the PreviewKeyUp function to handle keystrokes before they might otherwise be dealt with. It works fine, but often (not always) if I switch to another windows application and then back, it just stops working. If I interact with anything on the form that can accept focus (say a button, or a tex...

WPF Resources TargetType

Hi, I am trying to make resources for setting the Text ForeColor by doing the following in a Resources.xaml file <SolidColorBrush x:Key="windowsTextForeColor"></SolidColorBrush> <SolidColorBrush x:Key="windowTextBackColor"></SolidColorBrush> <Style TargetType="{x:Type TextBlock}"> <Setter Property="Background" Value="{DynamicResou...

WPF: how to make the (0,0) in center inside a Canvas

The WPF Canvas has a coordinate system starting at (0,0) at the top-left of the control. For example, setting the following will make my control appear on the top-left: <Control Canvas.Left="0" Canvas.Top="0"> How can I change it to the standard cartesian coordinates? Basically: (0,0) at center flip Y I noticed this post is...

WPF KeyDown and Keyup events

Hi when I do in one of my user controls in a WPF application, this.KeyUp += new System.Windows.Input.KeyEventHandler(MultipleControlViewer_KeyUp); or this.KeyDown += new System.Windows.Input.KeyEventHandler(MultipleControlViewer_KeyUp); or this.AddHandler(Window.KeyDownEvent, new System.Windows.Input.KeyEventHandler(MultipleControlViewe...

how do i make that dang wpf popup go away?

when i use a popup, it seems to hang around. in the code below i attach a popup to a textBox using by overriding the control template, and make the popup appear when the TextBox has focus. When you tab to the next on screen element the popup goes away, but if you just alt-tab to a different application the popup stays there in the foregr...

How to design Patient Journey Demonstrator Scrollbar?

How to design a scrollbar/Slider like MSCUI Patient Journey Demonstrator - Patients charts page and Most Recent Activities (not the normal scrollbar)? I require the scrollbar/ slider which shows the Year data on the left and Bottom side of the above options. I don't know exactly what type of controls that is and pls help me. Any kind of ...

WPF Save Changes in DataGrid to DataTable

My application requires that changes made in the WPF DataGrid control are saved back to the DataTable.I have managed to save data from the DataGrid to DataTable, however, the data saved from the DataGrid does not show the changes I have made, it just shows the data that was already there when the DataGrid was first populated. I have got...

How to set mouse position in WPF

actually there is a way described in http://social.expression.microsoft.com/Forums/es-ES/wpf/thread/6be8299a-9616-43f4-a72f-799da1193889 [System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint = "SetCursorPos")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedTyp...

properly resize wpf ListView's last column

How to properly handle listview's last column sizing in such a way that: listview does not display the ugly and unused 'extra' column (see picture 1, or here for example) the (actual) last column is stretched to fill the remaining space the horizontal scrollbar is not shown resizing in any direction leaves no artefacts (see below) I'...

Surface development: Translate/Rotate/Scale items without ScatterView

Hi, Is it possible to transalte/rotate/scale items without a ScatterView? I want to manipulate items which can be on top of other elements like a button, list or a custom control which should be static . When I add them to a ScatterView, they all become ScatterViewItems which is not the desired effect. Thx! Maarten ...

What does this WCF error mean: "Custom tool warning: Cannot import wsdl:portType"

I created a WCF service library project in my solution, and have service references to this. I use the services from a class library, so I have references from my WPF application project in addition to the class library. Services are set up straight forward - only changed to get async service functions. Everything was working fine - un...

WPF CheckBox Binding - Altering value in Property Set does not affect UI

Hello! i have a simple checkbox <CheckBox IsChecked="{Binding ForceInheritance}"/> In Code i have a class with "INotifyPropertyChanged" and the Property public bool ForceInheritance { get { return forceInheritance; } set { if (forceInheritance != value) { value = SomeTest(); if (forceInheritance != value)...

Nested controls with the same property: Attached property vs. data binding?

This is what I want: I have a custom Panel which arranges a certain type of item. My Panel also has a few dependency properties (ArrangeMode, MinDate, ...), which influence the rendering. Example: <TimeLinePanel ArrangeMode="Compact" MinDate="..."> <TimeLineItem ... /> <TimeLineItem ... /> </TimeLinePanel> To be able to data-b...

Anchor in WinForms==Horizontal(+Vertical)Alignment in WPF?

Can't find anchor property in WPF, was it reconstructed to Horizontal and Vertical Alignments? Is it the same? I wanted to stretch my control in both sides (right and left), but it worked rather different than anchor ...

multiple styles wpf from which user can choose

I want let the user choose what style my application has.Small example would be 2 buttons, if user presses button 1 then the background color turns red, if the user presses button 2 then the backgroundcolor turns green. How do i do that? do i use multiple resource dictionaries? and apply them when the button is pressed? Whats the most ...

Saving Bitmap Images in WPF via C#

Hey I display images in my WPF app using BitmapImage. However, I would like an easy way to save these (as JPG) to a different location (ideally into a Stream or object that can be passed around) Is it possible using BitmapImage or do I have to use other means? If so what other means are there for either loading an Image and saving as J...

WPF Fluidkit ElementFlow, Apply ItemTemplate to individual items.

Hello, I am currently binding an ElementFlow control to an observablecollection of BitmapImages. My elementflows datatemplate is set up to decorate each item with a blue border. However, I was wondering if someone with experience in using FluidKit could advise me on how to set the ItemTemplate of individual BitmapImages based on certai...