wpf

How to attach the alpha value of an element to a slider?

Is it possible to bind the alpha value of an element to a slider? For example, this is code that allows the slider to change the height and top position of the element, but what is the syntax to control the alpha value in the Background attribute of the border? <Window x:Class="WpfApplication25.Window1" xmlns="http://schemas.micros...

Using Logging from Microsoft Application Block with WPF

I have a WPF application and I want to use the Microsoft Application Block for logging (MIcrosoft.Practices.EnterpriseLibrary.Logging) How can I configure it in order to work? ...

Multi-level grouping using a CollectionViewSources

When databinding a TreeView, how would you create multiple levels of grouping for the items displayed? Imagine you are binding to a Shop class which, among others, has the properties "Region" and "RetailChain". The desired effect is to have a TreeView that displays the shops in the following topology: + Region: California | + Walmart ...

WPF Snoop not working on Windows XP?

Hello, Has anyone else noticed that the WPF developer's best friend, Snoop, is not working on XP? I've tried Snooping Expression Blend (a WPF app) and other WPF apps too. Snoop finds them but doesn't launch the window when the binoculars button is pressed. EDIT: I'm running obviously XP SP2 (with WPF support). -pom- ...

How to create a WPF Path which stretches in places

I'd like to create a WPF control for a window tab, and I want it to have a particular shape. Something like this; +------------------------------+ | | * | | | | +--+ +--+ 6 | ...

How to incorporate Canvas into a larger layout in WPF?

Canvas doesn't seem to play well together nicely with the other elements when you try to build it into a layout and have e.g. controls on the side and the canvas is the drawing area. For instance, why can I put a border around every element except a canvas? In the following code, border wraps canvas but the canvas only has the border on...

How to I access an attached property in code behind?

I have a rectangle in my XAML and want to change it's "Canvas.Left" property in code behind: <UserControl x:Class="Second90.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300" KeyDown="txt_KeyDown"> <Canvas> <Rec...

How do I match my controls' styles to the current theme? (WPF)

If I create a custom control with WPF, how can I provide styles for the control that match the currently applied theme (Aero, Luna, Classic, etc.)? For example I'd like to apply the following when using Aero: <Style> <Setter Property="Background" Value="White"/> </Style> But then apply a different style when using Luna: <Style> ...

Why doesn't the MaxLength property on a RichTextBox work in WPF?

I am trying to set the MaxLength property on a RichTextBox but it does not seem to work. Any ideas what might be happening? ...

Wpf style resource for foreground color of selected listbox item.

Background: I am creating a custom listbox that has radio buttons on each listbox item, so essentially it will be a RadioButtonList. The control is created entirely in code. As of right now the control renders and behaves correctly and supports 2 orientations (Horizontal/Vertical). The listbox uses an ItemTemplate that is a StackPanel wi...

Concatenate strings instead of using a stack of TextBlocks

I want to show a list of Customer objects in a WPF ItemsControl. I've created a DataTemplate for this: <DataTemplate DataType="{x:Type myNameSpace:Customer}"> <StackPanel Orientation="Horizontal" Margin="10"> <CheckBox"></CheckBox> <TextBlock Text="{Binding Path=Number}"></TextBlock> <Text...

How do I intercept a NotImplementedException in a WPF application?

How do I intercept a NotImplementedException in a WPF application? I'll occasionally throw a NotImplementedException while testing my in-progress WPF application: Private Sub ButtonDoSomething_Click(...) Handles ButtonDoSomething.Click Throw New NotImplementedException( _ "ButtonDoSomething_Click() not implemented.") End Su...

WPF Binding to a non-changing property

I'm using the MVVM pattern and I have a POCO (in my Model) with a Start Date property. I want to show the elapsed time since the start date in a control on a WPF window/user control... I don't see how I can bind a ModelView property to a UI control and have it update this duration automatically...can anyone suggest a way? I could use...

Load a BitmapSource and save using the same name in WPF -> IOException

When I try to save a BitmapSource that I loaded earlier, a System.IO.IOException is thrown stating another process is accessing that file and the filestream cannot be opened. If I only save whithout loading earlier, everything works fine. The loading code: BitmapImage image = new BitmapImage(); image.BeginInit(); image.UriSource = ur...

How can I cancel a user's WPF TreeView click?

I've got a WPF application with a Treeview control. When the user clicks a node on the tree, other TextBox, ComboBox, etc. controls on the page are populated with appropriate values. The user can then make changes to those values and save his or her changes by clicking a Save button. However, if the user selects a different Treeview n...

How do I properly handle a PreviewMouseDown event with a MessageBox confirmation?

Earlier I asked how to cancel a WPF TreeViewItem.Selected event. The answerers suggested I instead handle the PreviewMouseDown event before the selection even takes place. That makes sense. I've tried to do that... XAML... <TreeView Name="TreeViewThings" ... PreviewMouseDown="TreeViewThings_PreviewMouseDown" TreeViewItem...

WPF - App.xaml file does not get parsed if my app does not set a StartupUri ??

Background: I'm creating a WPF app using MVVM, and using a DI container to build my ViewModels My App.xaml looks like this: <Application x:Class="WpfApp.App" ...xmlns etc... StartupUri="MainWindow.xaml"> <Application.Resources> <app:ServiceLocator x:Key="serviceLocator" /> </Application.Resources> </Application>...

WPF Design question

Lets say i am developing a chat, first you come to a login window and when your logged in i want to use the same window but chaning the control :P how would be the best way to desight this? is there any good way to implement this what root element should i use? Thanks a lot!! ...

Forms Authenticate

HI , i must create an application with a Forms Authentication in WPF, so i create a database(UserId,Username,Password,PasswordQuestion,PassworAnswer) and store data with Linq ToSQL but i don't know the right procedure how to create LoginForm to authenticate the username and password with Linq ToSQl and set up the roles for each user. D...

WPF Bind DataTable to repeated user controls

I'm in the process of teaching myself WPF, and I have run into a small issue that I can't find the answer to. My test app allows image files to be dropped into a StackPanel. Once an image is dropped, a new user control is added to the stack, and displays some meta-data about the file. All is working correctly, and I can iterate throug...