wpf

unable to set focus to datepicker using attached property in wpf

Hi Experts, I have a custom datepicker with me and i am trying to set focus to this using attached property. I have the toolkit version 3.5.50211.1 which was released on Feb 2010. The focus is working fine when i do DatePicker.Focus(); in my code. My custom datepicker code is as follows: -- My DatePicker using System.Collections.Gene...

How do I link to a web page inside a WPF menu item?

I've found some fairly long-winded ways to do this, but can't believe it's that hard. I want to create a hyperlink to a web page and make that link into a WPF MenuItem. The hyperlink should ideally open in the default browser. IE would be OK at a pinch. Any ideas? ...

WPF: Set text-Label's transparency?

I have an ordinary Label and want to make it half-transparent. How to do this? Code is just: <Label FlowDirection="RightToLeft" FontSize="40" Padding="0" FontFamily="Arial" FontWeight="Bold""> X </Label> ...

WPF - How to add effects (like Shadow) to a Label

I have a Label and want to add Shadow to it. It seems like I can't apply the DropShadowBitmapEffect to it. What else can I do? ...

Binding not working... (WPF) "x:Name" problem?

I have two buttons, and need to link them with a line. I bind the Line coordinates to the button positions. I need to add this binding by code. In XAML this work very well like this: <Button x:Name="button1" Width="10" Height="10" Canvas.Left="150" Canvas.Top="150"/> <Button x:Name="button2" Width="10" Height="10" Canvas.Left="250" ...

Databinding in Blend

I have found an excellent video about how to bind controls to an XML dataset completly in Blend without a single line of code. I am trying to do the same - bind a textbox to a value of Dataset --> MyDataSet.xsd which grabs the total number of rows in a table (executes: select count(id) from books). And I am having a really hard time doi...

Own event for custom UserControl in XAML!

I want to create an own event (which I'll fire via code) for a CustomControl via XAML. This would allow me to add a trigger for an animation which I create in XAML. ...

How to circumvent sender's write-protection in events?

I have a ColorAnimation inside a Storyboard. After that Storyboard finishes I want to change a property of the ColorAnimation within it. Sadly all sender's attributes seem to be write-protected, so how can I circumvent it? Here is the code: storyboard.Completed += new EventHandler(storyboard_Completed); void storyboard_Completed(ob...

WPF - Mixing style defined in dictionary with style defined in parent control

I define custom look for Button control in resource dictionary: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Style TargetType="Button" x:Key="BaseButtonStyle"> <Setter Property="Background" Value="Blue"/> </St...

wpf animation events overlapping

I've got a canvas control that grows in height when you move the mouse over it and shrinks back on mouse leave. <Canvas x:Name="infoBar" Width="720" Height="39" Background="Red"> <Canvas.Triggers> <EventTrigger RoutedEvent="Canvas.MouseEnter"> <BeginStoryboard> <Sto...

How to make the content of a WPF listview occupy all the width available to the list.

I would like to have the columns of the WPF listview: Grow or shrink in size to occupy all the width available to them, and Have the content of those columns grow or shrink in size to fit those columns. The content of the columns in my case is text so this means font size will grow or shrink to fit the column. This code will do almos...

How do i attach property to a custom event?

I have a custom event and want to attach a property (a string would be fine) to it. What do I need to change in my code: public static readonly RoutedEvent ModelClickEvent = EventManager.RegisterRoutedEvent( "ModelClick", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(InfoBox)); // Provide CLR accessors for ...

WPF/WCF Client-Server Music Server

I would like to develop a WPF/WCF client/server app that permits client apps to control a server-side/music-server across a LAN. My hope is for the client/server application to permit: Clients to subscribe to the server. Clients to send commands (WS-* protocols) to the server that operate the music-server. Server to broadcast any musi...

WPF treeview: how to implement keyboard navigation like in Explorer?

I am using the WPF treeview for the first time and am astonished of all the basic things it does not do. One of those is keyboard navigation, implemented in any self-respecting treeview, e.g. in Windows Explorer or Regedit. This is how it should work: If the treeview has the focus and I type (letters/numbers) the selection should move ...

How to add a new record to database from XamDataGrid

Hi, I am using a XamDataGrid to populate say books. I want to ADD/EDIT/DELETE books from XamDataGrid and the change should reflect in the database. i.e. when I edit the record in XamDataGrid changes should be stored in the database similarly for Add and Delete. Can anyone please give me sample code or explanation how to achieve this? I...

Is it Possible to Nest Collections within Collections using Wpf DataGrid?

I want a simple sample program that nests collections within collections using Wpf DataGrid. ...

WPF binding for a converter not working

I have a custom converter that has a DefaultText property. All my converter does is return the DefaultText if the string is null or empty. I can't seem to get it to work though. Here's what I've got. This is the converter class. public class DisplayValueConverter : DependencyObject, IValueConverter { public static readonly Dependenc...

WPF: How do I set the content of a Paragraph in Code?

I've got a FlowDocument and assigned a name to one paragraph. I want to edit the content of a paragraph (which is just one ordinary string btw.). How to do this? ...

View a WPF UserControl on another computer over LAN

I have a UserControl (inherits Canvas) on a WPF Window that is reading and displaying some realtime imagery, and overlaying shapes and text atop the image. I'm looking for ways to clone this Canvas onto another WPF Window on another computer. The host computer has a bunch of controls that affect the programs operation, I want the client...

Binding To Dictionary

I'm trying to bind a dictionary to a combobox and I can't figure out how to make the selected item bind properly. The selected item looks like this: [1, 1 Pocket] All the expanded items look like this: 1 Pocket How do I make the selected item look like the expanded items? Here is the code behind: var pocketComboValues = n...