wpf

Why is the ScrollViewer ScrollChanged event only raised after a small delay following a call to ScrollToVerticalOffset/ScrollToHorizontalOffset?

I was working with ScrollViewer and I noticed that when calling ScrollToHorizontalOffset or ScrollToVerticalOffset that this appears to have a delayed effect in raising the ScrollChanged event. I also noticed that the HorizontalOffset/VerticalOffset properties don't immediately have the value that was just set. After a small amount of ...

Drag drop in WPF

I have WPF application with drag-n- drop inmplementation... Whenever I drag tree item on a Grid it is processed by DragDrop Event of that Grid, but every time it get fired twice what could be the reason ?? Below is code for implementing drag drop on treeview void treeViewGroups_MouseMove(object sender, MouseEventArgs e) { try ...

Avoid MVVM/data binding for small windows?

I've found view models to be very useful for splitting user interface and business logic code. However, I've also made the experience that for small, simple windows a view model class just adds a lot of additional code, effectively reducing maintainability instead of improving it. Let me give you a simple, real-world example that I've h...

wpf: checking how many components are inside of a Span?

I have WPF Span that is used as a source to a TextBlock. I am doing some tests and it would be very helpful to know in code how many of which type of component is inside of the Span. For example, at one point I insert a new Bold() into the span's inlines. How would I check that there is exactly one Bold component contained inside of the...

Attach method on ViewModel to events in WPF

How can bind an event on a WPF Control to a method on my ViewModel? I have a ViewModel: class MyViewModel { public string MyText { get; set; } public void MyMouseHandleMethod(object sender, EventArgs e) { } } In a DataTemplate I've got: <TextBlock Text="{Binding Text}"> Now I would like to attach a method on my ViewModel t...

String to Image WPF Converter

How to code a converter in WPF to display four status icons in WPF, In my project I am planning to display following four status based on certain conditions 1) Red Dot icon - Unsaved data 2) Green Dot icon - Save successful 3) White Dot icon OR No icon - window has Initialized successfully and there is no unsaved data. 4) Error icon - ...

WPF, Frame Control, HTML DOM Document access

Ive used WindowsHost to host a WebBrowser control, and that has allowed me to access the WebBrowsers Document/DOM directly, t read HTML content via mouse clicks on HTML document elements and also to invokes on submit forms. I never found a way even in Net 3.5 to do this when I was searching at the time. Ive found this post http://rhizohm...

Is it possible to highlight a ComboBoxItem, but not set it as the selected item?

I have a combobox that I am populating with a list of parts for a Return Authorization receiving app. In our RA system, a customer can specify a return for a Kit, but only actually return part of the kit. So because of this, my combobox shows a list of parts that belong to the kit, and asks the receiver to choose which part was actually ...

Composite WPF: Global variables?

In a Composite WPF application, what is the best way to store global variables needed by several modules? For example, I am working on an application in which several modules need to get a file name, so they can fetch the data they need from the file. Is there a best practice for storing information like this in a Composite WPF app? How...

How do you change the Track template of a Slider?

I would want to change the track a slider. Is there a way to do this? <Track x:Name="PART_Track" Grid.Row="1"> <Track.DecreaseRepeatButton> <RepeatButton Style="{StaticResource SliderRepeatButtonStyle}" Command="{x:Static Slider.DecreaseLarge}"/> </Track.DecreaseRepeatButton> <Track.IncreaseRepeatButton> <RepeatB...

Can WPF run without DirectX?

This might sound like a stupid question but ... will WPF stop running in absence of a DirectX/Direct3D capable graphics card/drivers or will it just run slower? I know WPF is based on DirectX/Direct3D (even for simple controls) but I cannot find any reference on the topic which provides a good overview of borderline scenarios. Any hel...

wpf different borderbrushes for different sides

Is it possible to set different borderbrushes for different sides e.g. left and right blue and other to grey? (I've found only the dirty workaround here) ...

How to use Prisim within an ElementHost

I'm new to Prism and I am attempting to host a Prisim control within an ElementHost. I seem to be missing something very basic. I have a single WinForm that contains an ElementHost. The following code is in the form: public partial class Form1 : Form { public Form1() { InitializeComponent(); Bootstrapper boots...

Blend 3 in design time can't find my converters/Resources .(WPF)

Hi all I'm having troubles using Blend with my visual studio solution. In Runtime, and compile time everything is just fine. As you can see in the picture, Blend urges me to Build the project, but it does not change the situation, even after a successful build, rebuild, clean & build, it is still the same, the UI is blocked from the d...

Dependency Property dependent on another

How can one register a dependency property whose value is calculated using the value of another dependency property? Because the .NET property wrappers are bypassed by WPF at run-time, one should not include logic in the getters and setters. The solution to that is typically to use PropertyChangedCallbacks. But those are declared stat...

WPF ScrollViewer Elastic Effect

I want to build a custom ScrollViewer control, based on the original ScrollViewer of WPF actually, and I wanted to add an elastic effect to it! I tried methods like ScrollToVerticalOffset() but they won't go beyond the scrollable content of the ScrollViewer! I don't know how to exactly emulate the elastic effect (which is when you reach ...

Is it possible to create a WPF tab control template that looks nothing like a tab control?

What I'd like is a control that functions just like the tab control but instead of having the tabs along the top, the items would be displayed in a list box along the side. I imagine it's possible but haven't found any examples, I'm hoping there's someone here that's done something like this. ...

Maintain a single connection or open only when i need to change something?

I have an SQL server on a server at home (which is an Atom processor with 1GB ram), and i'm using it to store data for one or two of my applications. I was wondering if i should create a DataContext object when the program starts then hold onto it for the entire life of the app, or only create the connection when necessary. What happens...

WPF button in ListView group header (MVVM)

I have a button in my ListView group header that performs operations on the group as a whole, and I am having trouble binding the Click event to an ICommand in my view model. I'm using SimpleCommand from C# Disciples if that's any help. http://marlongrech.wordpress.com/2008/11/26/avoiding-commandbinding-in-the-xaml-code-behind-files/ I...

SketchFlow - Merge and Report Multiple users feedback

I'm using Microsoft Elements 3 SketchFlow to get user feedback, but how can I merge them together or at least print them? ...