wpf

Thread Question

I have method which create background thread to make some action. In this background thread I create object. But this object while creating in runtime give me an exception : The calling thread must be STA, because many UI components require this. I know that I must use Dispatcher to make reflect something to UI. But in this case I ...

WPF TextBox TextProperty metadata override

How to override the TextProperty Metadata to set the UpdateSourceTrigger.PropertyChanged by default while using the functionality from the base TextBox Class TextBox.OnTextPropertyChanged TextBox.CoerceText methods, when both mentioned are private ? public class MyTextBox : System.Windows.Controls.TextBox { static MyTextB...

Can I expose only a portion of one .NET DLL's public classes via a different "API" DLL?

I am designing a WPF application that uses a DLL with maybe 40 public classes. I need these to be public for a variety of reasons including ease of data binding and obfuscation. I would like to allow other people to use only a portion of these classes as an API for my software. I thought I would create the main library (core.dll) and ...

How does CommandManager.RequerySuggested work?

The MSDN only states that Occurs when the CommandManager detects conditions that might change the ability of a command to execute. However I can't seem to find any traces of how this works, what I should be aware of / avoid etc... Does it just listen for input? (i.e.: mouse moves, keys pressed and so on) ...

How to give the condition for EventTrigger?

Is it possible to give the condition within the EventTrigger?? I have written a following EventTrigger (Mouse.MouseLeave) for Radio button. I want this should not be trigged for an item which is in Checked condition (IsChecked=True). <EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="border"> ...

How to use two templates for ListViewItem using WPF

Hi, I would like to have a ListView that would have have items similar to Microsoft Outlook inbox with items arranged by Conversations (see the attached photo). An item can either be a simple textblock containing the topic of the conversation (on the photo this are the blue lines) or it can contain email information specified by the Lis...

How to Read Device Data From serial port

I have one device which sends data on COM port say on COM13. Now i want to read that data and display it in the RichTextBox or in any text control. I have written the application with the help of IO and IO.Ports but comport.DataRecived event does not fire, even though device is sending data on that port. I have some software on which i...

wpf show video in ecllipse shape

Hi, I want to show a video in an ecllipse shape. How can i do it? Can i use the Clip property on it? how? Thanks. ...

WPF ListView control.

How to add hyperlink column in wpf listview at runtime ? ...

WPF StringFormat={0:C} showing as dollars

Why does this line of code <TextBlock Text="{Binding Net, StringFormat=c}"/> Output the result as $xx.xx when all my regional settings are set to UK. I expect it to output it as £xx.xx. Any ideas? I have tried different variations of the stringformat including StringFormat={}{0:C} but still get the same result. Thanks for looking. ...

Color of OverFlowButton in WPF toolbar

There was a problem. When I change the background color of WPF toolbar Overflow Button in the right corner does not change color. How to fix it? Example: ...

How to color a mesh with values at the vertices in WPF 3D?

We've got a sphere which we want to display in 3D and color given a fuction that depends on spherical coordinates. The sphere was triangulated using a regular grid in (theta, phi), but this produced a lot of small triangles near the poles. In an attempt to reduce the number triangles at the poles, we've changed out mesh generation to pr...

TreeView Scrollbar in PreviewMouseMove

I'm trying to implement drag/drop in my TreeView and have it all working except once the scroll bar appears inside the TreeView. When the user attempts to scroll the bar by dragging it up or down PreviewMouseMove naturally gets fired. However, I cannot figure out a way to recognize that the mouse is over the scrollbar and not initiate ...

Binding to an observableCollection<string> listview

Hi, If i have a ListView (called "MainList") and want to bind to elements in a collection, how is this done. Main.Items.Add(new ObserableCollection() { "hello", "world" } then Why doesnt this work? Ive tried loads of other combinations of bindings as well.... Thanks U. ...

How can I prevent row selection in the WPF Toolkit DataGrid?

I see a few options available for row selection, but 'No Selection' is not one of them. I've tried handling the SelectionChanged event by setting SelectedItem to null, but the row still seems selected. If there is no easy support for preventing this, would it be easy to just style the selected row the same as an unselected one? That way...

Prevent delete/backspace of InlineUIContainers in RichTextBox (WPF)

I have a RichTextBox that allows the user to type and edit and insert some complex UIElements that are wrapped in InlineUIContainer. The problem is when the user tries to delete/backspace one of the InlineUIContainers. I would like to disable deleting of these InlineUIContainers and I have another way for the user to delete them. I ...

Hang during databinding of large amount of data to WPF DataGrid

Im using WPFToolkit datagrid control and do the binding in such way: <WpfToolkit:DataGrid x:Name="dgGeneral" SelectionMode="Single" SelectionUnit="FullRow" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDele...

NOOB Challenge Implementing MVVM in WPF

To preface, this is my first attempt at MVVM... I buy it, I'm just having a little trouble implementing it. I'm building a utility to assist with managing a course. I have a COURSE object which contains a few properties and methods as well as a collection of MODULES. Each module has a few properties, methods and a reference to a PRESENT...

WPF/MVVM:Set multiple datacontext to ONE usercontrol

Hello, I have a UserControl with 5 small UserControl which are parts of the first UserControl. The first UserControl is datatemplated by a MainViewModel type. The other 5 small UserControls have also set the DataContext to this MainViewModel type. Now I want additionally that those 5 UserControls get a 2nd DataContext to access other...

Minimized window position in WPF

I am trying to save the position of a custom dialog to the users registry, so that when they reload the same dialog, it appears in the same place they moved or resized it to previously. I am saving the windows X position Y position Width and Height. It all works fine except for when the dialog is minimized. If the dialog is minimized a...