wpf

What is the syntax to define view/presenter pairs in XAML?

Why is that when I define a view with data context in this way: <views:MessageView DataContext="{x:Type presenters:MessagePresenter}"/> that my MessagePresenter does not run its constructor? What is the syntax to define view/presenter pairs like this in XAML? ...

Best way to implement "Remember Me" check box in WinForms / WPF

I want to add a "Remember Me" check box to the login form of my WPF App. What's the best way to do this? Currently the app logs in via a websevice call that returns an authenticated token that it uses for subsequent calls. Should I simply two-way encrypt and store this token somewhere in the files system? ...

WPF, Image MouseDown Event

I have an control with a mouse down event where Id like to chnage the Image when the image is clicked. But I cant seem to alter ANY of the images properties in the event. Event private void Image_MouseDown(object sender, MouseButtonEventArgs e) { BitmapImage bitImg = new BitmapImage(); bitImg.BeginInit(); ...

Accessing codebehind object in XAML

Hello, Another post describes how to access a codebehind variable in XAML. However, I'd like to access a variable in codebehind object from XAML. The codebehind object, called FeedData, is declared as a dependency property of type FeedEntry. This class is just a container class with string and datetime properties. Codebehind's proper...

How do I elegantly handle using a PasswordBox in WPF?

I'm aware that you can't Bind to PasswordBox.Password in WPF. How do I handle a form that contains one? All other controls on the form are bound to properties on a business object, but I have to manually set and retrieve a password property whenever the input changes. I know that others have created custom controls that allow binding to...

Nested menu regions in Composite WPF application

Is it possible to have nested regions in a Composite WPF application? I want modules to be able to inject new menus, and also be able to inject menu items into an existing menu. Using the following code the RegionManager throws an exception saying "The region manager does not contain the MainFileMenuRegion region": <Menu cal:RegionMana...

ContextMenu.StaysOpen Property (WPF)

Simple question here: what does the StaysOpen property of the ContextMenu (or equivalently Popup) control actually do? I have tried observing the difference in behaviour, but I notice none whatsoever. MSDN states the following: true if the menu should stay open until the IsOpen property changes to false; otherwise, false. The defau...

Help: Why my first WPF application not working?

My first WPF application, but it is not working. Help please! xaml: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="308" Width="527"> <Grid Name="canvas"> <Canvas></Canvas> ...

Bind Controls TO standalone animations

Hi, i'm new to wpf and i'm try to learn something. My problem is : i need to bind all that i want to a looping animation... Example: <Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <StackPanel> ...

WPF Binding Help

I haven't used WPF that much so the solution to this is probably pretty easy. In the ide I'm developing it will have multiple controls(text editor) each being hosted in a tab, much like VS does for each source file. When the user clicks new the "host" creates a new EditorWindow(a usercontrol), creates a new tab, and tells the tab to di...

How can I create a fluent interface for defining Dialog Boxes?

I am looking for examples and experience of using fluent interface to define simple Dialog Boxes (and other UI elements). (I may need to add support for custom Dialog Boxes to an in-house programming language and I think a fluent interface may be the best way of doing it) The UI system will be build on Winforms OR WPF if that effects ...

Update UI from external event

First of i am not a UI developer and this is probably a very simple problem. What i have is a external service that I subscribe to an event, when ever that event fires a service picks this up, manipulates the data in some way then gives the UI the data to display What i am unsure of is how to archetect this and keep the dependancy betw...

Unable to set the DropDownHeight of ComboBox

I cannot get the DropDownHeight of the ComboBox set properly to display all the items. I am using a control that inherits from the ComboBox. I have overridden the OnDrawItem and OnMeasureItem methods in order to create multiple columns and text-wrapping within a column if it is required. This all works fine. The problem occurs when I...

WPF issue with TreeView and Popup controls

When using a Popup inside a TreeView in WPF I am running into an issue where the controls inside the popup become unusable. For example, using the following code the ToggleButton inside the popup can only be toggled once and then becomes unable to be toggled back. Is there any way to work around this issue? <Page xmlns="http://schemas.m...

C# WPF datagrid: ItemsSource

I want to know how you can modify properties of columns of a WPF toolkit datagrid once the ItemsSource has been set (it is set in XAML)? For example I want to make a specific column have the property IsReadOnly equal to true. So basically there are two things I want to know: -How can I get access to a specific column once the ItemsS...

How do I determine the coordinates of an item within a stackpanel?

I have a stackpanel that has N-number of children. I want to get the x,y coordinates of the children relative to the parent stackpanel. The children in the stackpanel are centered horizontally so whenever the stackpanel resizes the children are centered. Here's what I'm doing to get the TopLeft corner of the child item relative to the S...

What does the runtime do with XAML namespaces?

In every XAML document, there are one or more namespace declarations. ie: <Window x:Class="WindowsApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1 Height="300"> The declarations are in the form of a URL, leading me to ask: Does...

Change common color in ControlTemplate

I have a ControlTemplate which uses the same color in multiple elements. On certain triggers (e.g. OnMouseOver) I'd like to change that color. As far as I can see I have to define a setter for every element to change its color. Is there a way to reference a shared resource in the template that all contained elements can access, and which...

Getting error when using WPF CSLA Remote server

Hi, I am running a WPF app with a remote server setup but getting "The remote server returned an unexpected response: (400) Bad Request" . This is definitely a request size issue since I tried reducing the data size being sent and the call worked fine. From my configuration it looks like I have 2 Gigs set up, but it behaves like only ...

WPF -- Event Threading, GUI updating question

I'm trying to send two events to the main window so that I can show some kind of animation that will let the user know that I'm updating the data. This is an ObservableCollection object so the OnPropertyChanged is immediately picked up by the bindings on the main window. The sleep is only in there so that the user can see the animation...