wpf

Show animation till an operation completes wpf

I want to show an animation wile an operation takes place... and when that operation takes the data and load my datagird i want to stop that animation like in ASP.NET using Ajax or Json but I don't know how to perform same operation here... Kindly help me! media element don't help. ...

[WPF] Creating a GridView from a table structure

Is there a library/CLR command that allows me quickly (in a few lines of code) convert a tabular data structure (say List<List<string>>) into a displayable WPF DataGrid? I'm looking for a function like: ListView FromIEnumerable(IEnumerable<IEnumerable<object>> source) {...} Which would be used as panel.Content = FromIEnumerable(Read...

Binding a wpf combobox to an element

A very basic question : I want to bind a wpf combobox to a selected element, so it displays the same value as the textbox : <StackPanel DataContext="{Binding ElementName=comboBox1, Path=SelectedItem}"> <TextBox Text="{Binding Path=Id}"></TextBox> <ComboBox .... When changing the value of combobox1, the id of the ...

C# ComboBox GotFocus

I have a C# ComboBox using WPF. I have code that executes when the combobox's gotfocus is activated. The issue is that the gotfocus event is executed every time a selection is made from the combobox. For example, the gotfocus is executed when you first click on the combobox and then when you make a selection even though you have not c...

Setting DataContext for the root element in XAML without the property element syntax

I was wondering if it's possible to write something like this: <Window ... xmlns definitions ... DataContext=<!--Create an instance here--> ></Window> Instead of this: <Window ... xmlns definitions ... > <Window.DataContext> <local:CustomViewModel /> </Window.DataContext> </Window> I don't need workaroun...

WPF -- List / Detail Different Windows can they be synchronized and databound to the same collection?

I have a listbox that is bound to a List<T> -- this is working great. I'd like to let my users double click a listbox item and open a new window that will display the "detail" view for that record. I'd like this new window to be databound to the same collection as the listbox on the original window. Because, that window has a timer, wh...

How to create a custom control with both an enabled and disabled visual state and a content presenter.

I'm new to making custom WPF controls so I'd really appreciate a little help and some explanation. Here's the situation: I'm trying to make a custom control with the following traits: The control must have a content presenter. The control must have either a disabled/enabled visual state, or be tri-state, (unstarted/inprogress/finished...

WPF ListBox control horizontal scrolling in code

How can I set the horizontal scroll position of a list box in code? I have a list box with a wrap panel in the items template and I want to implement a 'page right' function that behaves like a page down down in a normal list but works sideways. Thanks! ...

Blend not rendering images in User Control

Hi, I am developing a WPF application, and I have created a user control called ViewIconUC. This control lives in an assembly (MyControlAssemblyUI). I can instantiate the control in a ZAML page within this control, and I get no errors (I even attached the dugger to Blend to check), and I can see the button background I set in the control...

Finding the handle to a WPF window

Windows forms had a property win1.Handle which, if I recall, returns the handle of the main window handle? Is there an equivalent way to get the handle of a WPF Window? I found the following code online, IntPtr windowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle; but I don't think that will help me because ...

How to bind a WPF CollectionItem's element's Visibible state to it's collection index?

Assume that the below XAML is a style applied to a Path that is a visual element of an item data template for a collection, I want to bind to the collection in such a way that if this is the first element of a collection, the path is collapsed. How can I go about doing this? <Style x:Key="PathStyle" TargetType="{x:Type Path}"> <Styl...

What is the strangest WPF bug you have seen?

I want to gather here the hard-to-reproduce WPF bugs along with their solution. So post them only if you have a solution for them, you can post just a link to them. I found one of these, and I put it here because I didn't found an easy way to put code on a blog yet (and I tried a few of those code formatters). Test1: Start the followin...

Avoid XAML Code Duplication

I am very new to WPF. The UI I was required to implement makes use of buttons that contain both an image and a textual label. Creating one of these buttons is straightforward: I set the button's content to a UniformGrid and drop an image and a label into the grid. However, since there are quite a few of these buttons in my GUI, how do I...

WPF - window.show() does not ever release its memory?

So I am new to WPF and I am having issues with my windows not releasing their memory after I open them with .Show(). I basically want to open a modeless dialog. What I see happening is the memory going up when I open the new window and then when I close it via the exit button on the top right, the memory never goes down. Any ideas on fre...

Safe and Secure way to Update over Internet in C#

What would be the Most secure and Safe way to allow software to auto-update without opening too many holes to enable a hacker easy access to a system? ...

How do you Print in WPF (VB)

I have a WPF form that has a toolbar then a StackPanel under it with several controls inside of the StackPanel. One of the buttons on the toolbar is to print. I need to know how to print in a WPF, and more specifically how to print just what is inside of the stackpanel. I am using Visual Basic.NET ...

Why don't custom events show up in Blend for a UserControl?

I have created a UserControl, and added a couple of custom routed events. The problem is these events only show up in Properties->Events when I am manipulating an instance on the art board. If I am editing the UserControl itself, the my custom events do not show up in the Events panel. Is this a limitation of Blend, or a side effect o...

modify width and height does not work in wpf

I am loading a canvas which contains a lot of children uiElements such as path, line, textblocks. When i look at the width it just shows NaN. When i try to modify the width and height it does not seem to do that. I have also noticed ActualWidth and DesiredWidth do not allow me to set as they are not objects. Please let me know if you hav...

Expression blend like functionality in wpf.

I got a canvas which has many uiElements as its children. When i get the xaml and paste it in Expression blend it displays it well. Now when i select a path in blend and resize it by dragging the height of it grows successfully increasing the width and the rest of the coordinates are automatically calculated. I need to give this kind of ...

How do I control where the output of a ClickOnce application is built (using Microsoft.Build.BuildEngine) to?

I have a ClickOnce WPF application that I am using Microsoft.Build.BuildEngine to build. Everything appears to be working correctly, but when doing a targeted build to publish the application it is putting the published output to .\bin\Release\app.publish This is despite setting the properties "PublishURL", "OutDir", "WebProjectOutputD...