wpf

WPF RichTextBox: Replace text with UI controls @ run time

Hi Guys, I need to develop a messenger-like text box, where certain tokens are being replaced with UI controls. Just for example, if the user types :-) it should be replaced with a smiley image. I have previous experience with WPF's RichTextBox and i understand the concept of TextPointer and TextContent. I just don't know how to repla...

Curious problem with console input in C#

When using Console.Read(), the implementation seems to think that as soon as you push enter, you've entered enough bytes for an eternity of reads. For example, if Read is called twice in a row, you can't enter one value on one line, push enter, and move to the next. Even if you only entered one character, Read just returns zero (Edit: Or...

WPF associate value with checkbox

I am new to WPF and am having issues with associating a value with an object. I have a TreeView with CheckBoxes and I am wondering how I can associate an object to each checkbox. I want to be able to select all the checked checkboxes (no problem) and get a list of objects that are associated with each checked box. For example, let's...

Navigation in Microsoft Surface

I'm writing an application for Microsoft's Surface table. I need to navigate between screens (Windows or Pages). Does the SurfaceSDK offer anything akin to a NavigationWindow? If not, how can I navigate between screens? ...

Is there a panel I can use in WPF that will "defeat" SizeToContent?

I basically want certain parts of my window to not affect SizeToContent (things like a title bar) so that it appears to have no size and collapses. Is there a panel I can use to do this (like a ScrollViewer maybe?) or do I have to write my own? ...

popup trigger not working as expected

I have two controls in a grid, an Ellipse and a Popup. The idea is that both of the controls are only displayed if the IsDirty property in a view model is true; if so, the Ellipse is green if the same view model IsValid and red if not, while the Popup displays messages if the user has the mouse over the popup. The content and bindings f...

Nesting a Progress Bar into a Combobox in WPF

Is it possible to nest a Progress bar into a combobox or the other way around. I want to be able to type into the combo box and hit a button and the progress bar shows the progress of the event, like in Windows Explorer. EDIT: I need the code in Visual Basic.NET 3.5 Thanks. ...

XAML: Refer to StaticResource in plain XAML? (without markup extension)

I am setting a validation rule on a series of textboxes. I'd rather not create a new instance of my custom validation rule for each TextBox... <Window.Resources> <my:IsIntegerRule x:Key="IsIntegerRule"/> </Window.Resources> ... ... <TextBox> <TextBox.Text> <Binding XPath="@num" UpdateSourceTrigger="PropertyChanged" Mode="T...

White Border around GroupBox

How do I remove the white borders? ...

Does Triggers inside control template or style have orders?

Is there any order of execution for the trigger inside a controlTemplate of Style?. eg. IsMouseOver trigger should comes first after thenat IsSelected anything like that? ...

Display image while dragging

How can i put an image in corner or center of cursor while user dragging an item in ListView or other controls like that? When you dragging an image or text in Firefox; same thing occurs. ...

How can I keep an observable collection sorted in a listbox?

I have the following to get data from an Entity Framework 4: IQueryable<Exam> examsQuery = entities.CreateQuery<Exam>("[Exams]").Include("Course"); exams = new EntityObservableCollection<Exam>(entities, "Exams", examsQuery); In my viewmodel I have the following code: public IEnumerable<Exam> Exams { get { return exams; } } ...

WPF & WCF relationships

I heard that WPF is more suitable than WinForms for working with WCF. Is it true, and if so, why? ...

WPF TreeView HierarchicalDataTemplate get TreeViewItem

I am using a HierarchicalDataTemplate to bind my classes to a TreeView with checkboxes. I have the code working fine and everything is displayed fine, but I'd like to be able to get a list of children of an item in my treeview. When a checkbox is clicked, I want to be able to select the parent nodes and child nodes. If I had access to...

WPF Focus Animation not working properly

Hi, I have a WPF usercontrol set up in XAML with the following Triggers: <UserControl.Triggers> <EventTrigger RoutedEvent="GotFocus"> <BeginStoryboard> <Storyboard> <DoubleAnimation To="1.5" Storyboard.TargetName="ImageContent" Storyboard.TargetProperty="RenderTransform.Childre...

wpf .net 4 - listview vs datagrid

I have implemented the listview to show an Observable collection coming in an MVVM desktop application. Now I'm wondering if I should have used the new datagrid instead. Can someone tell me what are the main advantages of using a datagrid control. I looked for some listview vs datagrid docs on the web but didn't find anything recent. T...

WPF - Drawing a line of text with different background colors

I need to draw a line of text with that has a different background for part of the string (i.e. like a highlight) in WPF. The FomattedText class allows you to set various attributes for different parts of a string like bold, underline fore color etc but does not have background color. I think using TextFormatter and writing a custom Tex...

XML, SQL Server Compact, or Something Else?

I am developing a desktop application that will need to collect data (from the user) and store it locally in a secure fashion. It will need to synchronize this data with a central database when an internet connection is available. The application is WPF and I would like to take advantage of the new data-binding features of WPF. I really ...

Emulating OwnerDraw controls in WPF

In the past, I developed a customized combo box in win forms which implements auto complete behavior where the matched portion of the text is highlighted in blue, whilst the rest of the string has the normal background color. In win forms this can be done fairly simply using OwerDraw mode. I need to do similar kinds of things for WPF con...

wpf datagrid selection changed

Hello, I used to have the following code using a listview: private void ListViewSelectionChanged(object sender, SelectionChangedEventArgs e) { foreach (Exam exam in e.RemovedItems) { ViewModel.SelectedExams.Remove(exam); } foreach (Exam exam in e.AddedItems) ...