wpf

Change non static object from static Context

I have next dependecy property: public static DependencyProperty IsInReadModeProperty = DependencyProperty.Register("IsInReadMode", typeof(bool), typeof(RegCardSearchForm), new PropertyMetadata(false, ReadModeChanged)); and I have next method which handle Property changed event: public static void ReadModeChanged(DependencyOb...

How to set and change the culture in WPF

I have a .NET 4.0 WPF application where the user can change the language (culture) I simply let the user select a language, create a corresponding CultureInfo and set: Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; In the C# code this works fine. However in the WPF controls the...

Button calls mouse event functions.:)

Hey guys (: I'm currently working on this project which consists of zoom function. Now, I am facing this problem where the zoom function that used by me required four mouse events, which are Mouse wheel, Mouse left button up, down etc. However, I am trying to make it like when a button is clicked, the zoom function can be carried out eve...

WPF - How to paint notebook-like lines as TextBox background?

A bit similar to this question. My aim is to evocate a notebook-like look of the textbox. OneNote does something similar, by setting background image of the editing surface. Of course it is not possible to align the lines in OneNote because the text can be freely formatted. I would like to do this with constant font (no formatting)...

Exception: The specified Visual is not an ancestor of this Visual

The following method thrwos an exception in the line: Point childPosition = vb.TransformToAncestor(surfaceWindow).Transform(new Point(0, 0)); But if you look at the code, the vb is surely a child of surfaceWindow. So why isn't this working? if (!isExpanded()) { Viewbox vb = new Viewbox(); ...

In WPF, how can I cross-reference resources between ResourceDictionaries?

Hi. I work on a WPF project with many UserControls and I'm trying to put some sanity in my WPF resources. A base file contains generic stuff needed by all views, such as colors: <!-- Resources.xaml --> <Color x:Key="FlashOrange">#F59500</Color> Then, a resource file specific to a view needs to reference FlashOrange: <!-- ContactV...

WPF TreeView with checkboxes.

Hi all! After a lot of searching, I have not found any solution for the following problem. I need a treeview control with "checkboxed" treeview items and the CheckedItems property for convenient data binding (for example, tree view of folders' structure, when user checks folders, the size of checked folders is displayed in a textbox). B...

wpf schedule control

Hi, I'm looking for a very simple schedule control for WPF. What I need is something like daypilot or the Outlook scheduler but with minimal functionality. I simply want to show a day separated in 24 interval (one for each hour). Inside these 24 hours, the user has to define events/task, non-overlapping each other. That's for theory. Pr...

Displaying images with a high frame rate

Hi, here's the problem: I have a custom hardware device and I have to grab images from it in C#/WPF and display them in a window, all with 120+ FPS. The problem is that there is no event to indicate the images are ready, but I have to constantly poll the device and check whether there are any new images and then download them. There a...

Binding to a Combo Box not working

I have the following Combo box binding which was within a WPF window. I needed to create the window as a UserControl and since doing that my binding will not show the itemSource. ComboBox Width="200" ItemsSource="{Binding CallerChoices}" SelectedValue="Sam" SelectedItem="{Binding CallerChoosen}" The Item source CallerChoices is a List...

Recording HD from webcam using Expression encoder sdk in WPF

I am trying to record a stream from a webcam using Expression Encoder 4 SDK in WPF I can capture the video & audio streams and record these to disk however they are only recording at a base resolution of 320x240 the webcam is capable of capturing at 720p, how can I record at this resolution. Any help would be appreciated, I have been pul...

Custom control not applying template in itemscontrol

I have written a fairly simple timeline control which extends control. It has a generic template that displays correctly when the control is used by itself. I have put the control in an ItemsControl and now no templates are being applied to the timeline (OnApplytemplate() isn't firing). I cannot for the life of me figure out what the pr...

Coding field navigation while creating paperless online versions of paper forms using WPF with C# and LinqToXml

Using WPF(with C# and LinqToXml), I am reproducing a paperless version of an existing paper form. The existing form includes some one-character-per-box text strings. I have already duplicated the appearance of the paper form using XAML. How can I add code to a one-character TextBox to automatically send control to the next TextBox onc...

WPF 4: Windows Forms Host, Crystal Reports Asynch

Is there a way to render WinForms controls like Crystal Reports Viewer asynch, or even in a different thread, without freezing the applicaton. My problem is that, when I assign the report source property, the viewer tried to render the report and some reports run for so long and it freezes the whole app. Thanks in advance ...

How to change the order of the TabItem in the wpf TabControl

I need to change the order of the TabItem. I've tried with Remove / Insert and it doesn't works. void UserControl_Loaded(object sender, RoutedEventArgs e) { if(condition) { TabControl.Items.Remove(TabItem); TabControl.Items.Insert(0, TabItem); } } InvalidOperationException: Element already has a logical parent. It mus...

ListView ItemContainerStyle Template

I created style to be used as my ListView's item template that contains a CheckBox and a TextBlock: <Style x:Key="CheckBoxListStyle" TargetType="{x:Type ListView}"> <Setter Property="SelectionMode" Value="Multiple"></Setter> <Setter Property="ItemContainerStyle"> <Setter.Value> ...

Why is my Popup showing opposite the Placement property on some machines?

I have a simple WPF Popup that I am showing when the user clicks a Button. <Button x:Name="aButton" Content="Up/Down" Width="75" Height="30" Click="aButton_Click" /> <Popup PlacementTarget="{Binding ElementName=aButton}" Placement="Right" VerticalOffset="-31" StaysOpen="False" AllowsTransparency="...

WPF Play MediaElement in UserControl using only XAML

Hi, I have this UserControl: <UserControl x:Class="Jugues.contacteButton" x:Name="contacteButtonControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" ...

How to find a point that is on the same circle given an angle?

I have the following setting: I know P1, P2 and the angle alpha, now how do i calculate the coordinates of P3? (Note: P3 is on the same circle with origin P1 and radius P1P2) The blue lines indicate the coordinate system ...

TreeViewItem Button Command binding

Good day, First question here and just learning WPF, so please be gentle... I'm trying to put together a TreeView whose items fire Commands. I'm sure there are many ways to accomplish this, but my approach has been to create a Style for the TreeViewItem with a ControlTemplate that incorporates a RadioButton for its Command functionalit...