wpf

How to animate ListBox Items on MouseEnter and MouseLeave events using C#/WPF?

I can't capture/trigger OnMouseEnter or OnMouseLeave events through C# code for list items. To be clear, I don't need an OnSelectedItem event. What I want to do is to be able to handle the OnMouseEnter and OnMouseLeave events for ListBoxItem which will start the DoubleAnimation for that ListBoxItem - I want to enlarge its font on Mouse...

C# Simple Countdown - What am I doing wrong?

I wanted to make a simple Countdown-Application with C# to show as an example. For the very first and basic version I use a Label to display the current time left in seconds and a Button to start the countdown. The Button's Click-Event is implemented like this: private void ButtonStart_Click(object sender, RoutedEventArgs e) { ...

Boolean Animation locks property

If I have a BooleanAnimation that sets a property, that property becomes locked and can't be changed by any other means. Example: <EventTrigger SourceName="myButton" RoutedEvent="Button.Click"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <BooleanAnimationUsingKeyFrames ...

What does it mean to "Capture the mouse" in WPF?

On System.Windows.UIElement there is a CaptureMouse() and a paired ReleaseMouseCapture() method. In this WPF DragDrop sample they call CaptureMouse on MouseDown and release it on MouseUp. The documentation in MSDN is about as useless as it comes - "CaptureMouse -> Captures the mouse." In my head before trying it I assumed that it some...

Setting a property with an EventTrigger

I want to be able to set a property with an EventTrigger, there's a number of problems with this. 1) EventTriggers only support Actions, so I must use a storyBoard to set my properties. 2) Once I use a storyboard, I have two options: Stop: Once the animation has stopped the value reverts back to before the animation started HoldEn...

Show message by iterating observable collection containing date and time.

I have a Observable collection which is bind to listview which contains date and time. When a time in the collection occurs a messagebox should be shown. I do as public class Reminder { public string Name { get; set; } public string Date { get; set; } public string Time { get; set; } } ObservableCollection<Reminder> remind...

WPF 3D textures with alpha channel

With WPF 3D, is it possible to have a texture with an alpha channel? I am wanting to make a 3d scene where everything is flat surfaces (like everything is paper cutouts). I thought the easiest way to achieve this would be to create a plane, divide it into quite a few triangle (like a cloth), then apply a texture with a transparent backg...

Smoothing of Vertices in MeshGeometry3D (WPF)

Hi I'm porting a DirectX application into WPF, using the Windows.Media.Media3D toolkit. Which is working good and all, except that the Model is rendered in-complete, even when it have gotten all possible data. I suspect it's because DirectX optimize and somehow smooth or help rendering additional content depending on the vertices and i...

Draw Sine Wave in WPF

This one seems quite stupid, but I'm struglling from an hour to do this, How to Draw the Sine Wave in WPF?? Thanks ...

How to set iccprofile for jpegbitmapencoder in WPF using C#?

using (FileStream outStream = new FileStream(path.LocalPath, FileMode.Create)) { JpegBitmapEncoder encoder = new JpegBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(renderBitmap)); encoder.Save(outStream); } After I save an image using the above code, it is having a red tint on it. If I open in adobephotoshop and unc...

How unique is XAML?

Was talking to a colleague about XAML and how it is both a presentation and object description language and therefore quite unique and novel among IT technology. Is this true that XAML is unique and novel? Does XAML have any counterparts or predecessors in the Java world or elsewhere? I believe someone told me that Java Server Faces w...

Does anyone have code examples of the WPF Datagrid working in a MVVM pattern?

I got the following example of a WPF DataGrid bound to a ViewModel in a MVVM pattern, but it is read-only: MVVM example which has buttons that switch the data in the ViewModel I tried to extend it so that the DataGrid was bound to an observable collection of ViewModels so that editing cells would fire OnPropertyChanged events on the ap...

How can I get a list of built-in routed events in WPF

I'm just starting out with WPF and need some help with routed events. I have added a datagrid with some animation, but i can't seem to find anywhere that shows me a list of routed events to use on the datagrid, or any other control for that matter. Seems to be a guessing game so far. I thought the datagrid standard events, such as C...

Problem DataBinding wpf KeyedCollection

Hello, I am a beginner to WPF Databinding and I just found a confusing kind of behaviour. Maybe someone can help me: My xaml code binds a listbox to a list: <ListBox ItemsSource="{Binding Path=Axes}" SelectedItem="{Binding Path = SelectedAxis}" DisplayMemberPath = "Name" Name="listboxAxes"/> If the actual item that is binded to is ...

Load WPF themes based on Monitor Resolution

I facing quite big problem with resolution in my WPF app, which will be used in Hospitals, customer is asked for BIG fonts and Controls so that they can see data clearly from the distance. The problem is now when application runs in 800X600 resolution, whole UI will get messed up, so I thought to define another theme for lower monitor ...

ListBox as Numeric UpDown control in WPF.

One of the disadventage I found in WPF is it doesnot have a Numeric UpDown control. So I make a listbox with height as 25 so that it will display only one item at a time and the vertical scroll feels like a UpDown controls. My problem is when I use the scroll to change the value, I can't get the current value shown in listbox. Can any i...

Get value from DataContext to MarkupExtension

I'm using M-V-VM pattern In my VM I have code like public class ViewModel { public XmlDocument Document { ... } .... } I have a markup extension from which I would like to use said document public override object ProvideValue(IServiceProvider serviceProvider) { IProvideValueTarget valueProvider = serviceProvider.Ge...

How to set BitmapImage.CreateOptions in WPF using C#

BitmapImage bi = new BitmapImage(new Uri(@"D:\DSC_0865.png")); bi.CreateOptions = BitmapCreateOptions.PreservePixelFormat; img1.Source = bi; In the above code, if I try to set bi.CreateOptions, it is not taking it. It is showing as none. Please can you suggest a solution? ...

Adding events to ScatterViewItems when implicitly creating them

Not sure there's too many surface developers on here but hey ho... If i have a scatterview which implicity creates the ScatterViewItem objects (see below), is it possible to retireve the contact events for each scatterViewItem? Also when i wrap tyhe image object in a ScatterViewItem explicitly the item no longer works. Could anyone adv...

WPF vs Silverlight.

What are the exact differences between WPF and Silverlight? ...