wpf

Disabling antialiasing on a WPF image

Hi Guys, I'm writing a small Login dialog, and have embedded a banner at the top of the dialog for aesthetic reasons. All went well, except that by default, WPF anti aliases the entire image, making the text that was contained within it frustrating blurry. After a bit of Googlin', the first few pages of results showed that it's common ...

WPF, how to determine when a MediaElement has finished playing the movie?

Hi, I am showing a movie on my application, and i want the application to only play it once. And when its done playing i want to enable some buttons (play, rewind, watch again etc...) but is there any way i can get an event when the movie has finished - or anything that would accomplish this scenario? Cheers, ...

Loading image in thread with WPF

Hi ! I'm trying to make a listbox that display pictures from internet. The items are provided by binding itemsource to a model that contain the URL of the image and some other properties (title, desc, etc...). Unfortunately, the list is very slow to load because WPF is trying to download all pictures from the web before showing the lis...

Inherited style throwing an InvalidOperationException when executing a PauseStoryBoard action

The XAML below does the following: when the mouse is over a textblock, its text will enlarge, when the mouse leaves the textblock its text shrinks. When the mouse is clicked the textsize freezes. This works as expected when the style of the Textbox is directly set to the SwellingTexblock resource. However, when the style is set to the S...

How to disable ScrollViewer in ListBox?

I have a ListBox. It has internal ScrollViewer, so I can scroll ListBox content with mouse wheel. It works fine until I set item template that contains another ListBox (in fact, I have 4 nested ListBoxes =)). Problem is that internal ListBox's ScrollViewer steals wheeling event. Is there any easy way to prevent this behavior? I had Li...

How do I programatically fire a command

i have an ICommand that I want to fire (make the execute go) from code; how do I do this? ...

Create and place an Image in WPF

Hello, It's simple enough to define an image in xaml and move it around, but how would I do this programmaticly? I define my Image like this: System.Windows.Controls.Image imgpanel = new System.Windows.Controls.Image(); imgpanel.Source = loadBitmap(capwin); And I'd like to be able to set it on my window. How would I got about this? ...

wpf center child window not working with sizetocontent

If i set sizetocontent to widthandheight, then WindowStartupLocation="CenterOwner" does not work properly. Instead of the center of the new window to be at the center of its parent owner, it looks more like the top left hand corner of the child window to be at the center of the parent. If i remove sizetocontent then all is ok. What is wr...

Bind WPF DataGrid ItemsSource to method, IEnumerable<TableRow> GetRows(), of custom Table object?

I am struggling with the learning curve on WPF data binding and could use an example. Bonus points for those that answer the question and link to an article that helped them "get" WPF data binding. I am trying to bind a custom Table object with a WPF DataGrid. Here is my objects (I do not have the ability to change them, signatures tr...

WPF TextBox Height Equals Parent Height minus 50 pixels?

I'm successfully getting a TextBox to resize with a parent Border height but I need the TextBox to actually be 50 pixels smaller in height than the parent Border. Any ideas how to achieve this? The code I'm using is <Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch" > <TextBox x:Name="txtActivityNotes" HorizontalAl...

WPF 3d rotation animations

Hi Everyone, I have a few 3d rectangles on my screen that I want to pivot around the Y axis. I want to press down with the mouse, and rotate the 3d object to a max rotation, but when the user moves their mouse, I want to slightly rotate it so that it looks like a see-saw (rotating from a range of -13 to 13 degrees on the Y-Axis). At ...

WPF 3d ImageBrush material help

Hi all, Im trying to apply a material to my GeometryModel3D at runtime like so: var model3D = ShardModelVisual.Content as GeometryModel3D; var materialGroup = model3D.Material as MaterialGroup; BitmapImage image; ResourceLoader.TryLoadImage("pack://application:,,,/AnzSurface;component/path file/img.png"...

How to rotate 3d object on Z axis only?

We used 3DTools (http://3dtools.codeplex.com) to draw a 3d line, it allows user rotate it by mouse. I have question, how to limit user can rotate it on Z axis only? or on X axis, Y axis only? <tool:TrackballDecorator > <tool:Interactive3DDecorator ContainsInk="True"> <Viewport3D> <Viewport3D.Camera> ...

WPF DataGrid control: adding the most recent row on top.

I want to programmatically add a row to the top in a DataGrid control. Any ideas? ...

How to bind ComboBox or ComboboxEdit to a DataTable

Hello, could anyone help me to set combobox or combobox edit values from a datatable? In WinForms it was something like this: DataSet dataBases = GetDatabases(); if ((dataBases != null) && (dataBases.Tables[0].Rows.Count > 0)) { comboBoxDataBases.DisplayMember = "DbName"; comboBoxDataBas...

How can I prevent duplicates in a WPF Listbox control?

I have a WPF listbox control that is declaratively bound to a textbox. The listbox's ItemsSource is an ObservableCollection that is built from an XML file. I can easily prevent duplicate entries in the listbox when a new item is added because I can check for it in the "Add" button's Click event handler. However, when an existing item's ...

WPF SplashScreen implementing

Hello, I try to implement Splash Screnn in WPF. I have found some nice ehample in MSDN, but there is one place: private void _applicationInitialize(SplashScreen splashWindow) { Thread.Sleep(1000); // Create the main window, but on the UI thread. Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Invoker)delegate { ...

Get controls by position within wpf FlowDocumentScrollViewer

I have a FlowDocument with much content inside. I need to get the controls that are currently in the visible area. with DependencyObject obj = FlowDocumentScrollViewerCtrl; do { if (VisualTreeHelper.GetChildrenCount(obj) > 0) { obj = VisualTreeHelper.GetChild(obj as Visual, 0); } } while (!(obj is ScrollViewer)); ...

WPF Make Interactive Charts

I'm using System.Windows.Controls.DataVisualization.Toolkit for charts in my WPF application. The code for chart is: <chartingToolkit:Chart> <!-- Volume --> <chartingToolkit:LineSeries Title="Volume (M)" ItemsSource="{StaticResource S...

Best way to launch a WPF ".application" Application

What is the best way (in JavaScript) to launch a ".application" Application through javascript? ...