wpf

WPF DispatcherTimer and Mouse Button Click Timing

Consider the following code, I have a textblock that is an "on/off" button in WPF. It's just text inside an ellipse that says ON / OFF. When the user clicks the button and holds the left mouse for ONE second, it will execute the 'turn device on' code if the device is not already powered up. If the user holds the ON/OFF button for three s...

Best Technologies for AJAX Web Development

Hey Everyone, I have some experience in AJAX development, mostly on .NET and MooTools. However, I want to learn more and see what others out there thought about the various other options available. I am looking more for advise about the front end. The back end, I will most probably be coding up in .NET using c# and WCF services. Please...

Replace text in WPF Richtextbox.

How to replace a character in WPf richtextbox? ...

How to Dispose BitmapDecoder object in wpf application.

I have developed a WPF Application, using BitmapDecoder to save images. While saving images i am getting an "insufficient memory to complete the operation" exception. The code looks something like this: BitmapDecoder imgDecoder = BitmapDecoder.Create(mem, BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.None); I think Bi...

Insert a image on cursor in wpf

Hi, How to insert image on cursor in xaml? I have .ani file. Thanks in advance Sharath ...

Strange behaviour of WPF's Validation.Error and Validation.HasError

I have TextBox which should only contain a valid integer. It’s validated using a custom ValidationRule. The problem I am experiencing is that when the TextBox.Text is invalid, say “3a”, and I type another “a”, then the TextBox’s attached property Validation.HasError changes from TRUE -> FALSE -> TRUE. My software reacts whenever the Vali...

How to have a WPF binding update every second?

I want to show the user how many seconds have passed since some event occurs. Conceptually, my view model has properties like this: public DateTime OccurredAtUtc { get; set; } public int SecondsSinceOccurrence { get { return (int)(DateTime.UtcNow - OccurredAtUtc).TotalSeconds; } } If I bind a TextBlock.Text property to SecondsSi...

Wpf Data entry Form bound to datatable...

Hi, I was trying my hand on binding in Wpf.I am trying to make a dataenrty screen.for instance,I have a textbox and a combobox and a listview.. users enter pick an item from the combobox,add a comment and add the item to the listview.This is the flow.I have a master table for the combobox,i have its selectedvalue bound to a Item field in...

Creating a WPF ValueConverter for a Brush

On the Nerd Plus Art blog today, there was a post about creating WPF Resources for arrows, which the author uses frequently. I have a side project that has Back and Forward buttons, so I thought that the Left and Right arrows would work great on those buttons. I added the LeftArrow and RightArrow Geometries to my application's resources...

Encapsulating and customizing a third party WPF control

I'm interested in customizing a 3rd party control, such as Telerik's RadGridView, as a standalone control, for example adding New Row and Delete Row buttons above the grid, yet still supporting XAML manipulation of the internals of the control by the window upon which my control exists (i.e. for the window to add its own style to a colum...

Good WPF focused blogs and/or podcasts?

Are there any good WPF focused blogs and/or podcasts out there? ...

How do you handle a ComboBox SelectionChanged in MVVM?

For those doing pure MVVM, how do you handle a ComboBox SelectionChanged event without reverting to code behind? I tried e.g. AttachedBehaviors but Event="SelectedChanged" is not supported: <ComboBox> <ComboBoxItem Content="Test1"> <c:CommandBehaviorCollection.Behaviors> <c:BehaviorBinding Event="SelectionChange...

What is the easiest way to break up large XAML files in my application?

I recently discovered that I could make use of user controls to reduce the size of my main application's .xaml file. I am new to WPF and realized that my app's XAML is getting very long, very fast and is cumbersome to scroll through. Are user controls the best way to address this issue (i.e. have lots of user controls and their template...

Why are events and commands in MVVM so unsupported by WPF / Visual Studio?

When creating an WPF application with the MVVM pattern, it seems I have to gather the necessary tools myself to even begin the most rudimentary event handling, e.g. AttachedBehaviors I get from here DelegateCommands I get from here Now I'm looking for some way to handle the ItemSelected event in a ComboBox and am getting suggestions...

AutoComplete TextBox in WPF

Hi, Can we make textbox to autocomplete in WPF? I found a sample where a combox box is used and the traingle is removed by editing style template. Do we better solution for autocomplete textbox? Thanks in advance Sharath ...

Setting the tag member of a ListBoxItem inside a datatemplate?

Hi, How would I be able to set the tag member of a ListBoxItem inside a datatemplate? I am databinding a ListBox and I am trying to add information to the ListBoxItem.Tag from my DataContext. I am using A DataTemplate to display the ListBoxItem. ...

The proper way to do this - binding to properties

Hi all, I have 2 controls that both bind to the same dependency property "Weather". In the first control you put the current weather, the other one displays a forecast. In my XAML of the first control I bind a TextBox that contains the "Humidity" as follows. <TextBox Text="{Binding Weather.Humidity}" /> Whenever the Humidity changes...

WPF On Start detect if process is started and bring application to front

Hello, I have a pretty simple problem. When program has been started and user tries to start another instance. That new instance needs to bring old instance to front and quit. The solution seams pretty simple, I could take the code from http://www.codeproject.com/KB/cs/oneprocessonly.aspx and be done with it. Fortunately/Unfortunatel...

WPF: Switch Template based on UserControl Data

Trying to implement what I thought was a simple concept. I have a user control (view) bound to a view model which provides a list of data. I have added toggle buttons to the usercontrol and would like to allow the user to use these toggle buttons to switch out which template is used to show the data. All of the templates used for the ...

(WPF) How to extract frames from multiframe images (tif, gif)

I'm trying to extract thumnail images of each frame in an animated gif. The following code is how I'm tyring to do it, but the thumbnail property of the BitmapFrame instance is always null. Am I doing something wrong? GifBitmapDecoder bd1 = new GifBitmapDecoder( new Uri(thisImage.Path), BitmapCreateOptions.None, BitmapCacheOption.D...