wpf

Requested registry access not allowed

When running my Windows Forms application on Windows 7 I get the following exception message: Requested registry access is not allowed. at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) at Microsoft.Win32.RegistryKey.Ope...

Is there a converter from WinForms to WPF?

I understand that the tecnhologies are vastly different, but I have a largish project that I would like to convert to WPF, and if there was a converter that could get it even 50% there, and show areas that it couldn't convert, then it would be helpful. ...

Bing Maps Imagery Service cannot find default endpoint

I am writing a C# WPF application that basically contains a datagrid of locations. I am trying to use the bing map service to load an image of a location into a tooltip for each element in the datagrid. I have added the Bing ImageryService as a service reference to my project. I am receiving an error that says : "Could not find default...

C# WPF ckeckbox to keyboard

I have a check box in my window, I want when the user clicks it works as if the user clicks on the ALT key on keyboard. How can I do this? ...

How to prevent WPF edit box scrolling to end on a programmatic SelectAll?

I have a TextBox that does a SelectAll() when it gets focus. Works great. The problem is that if the contents don't fit in the box, then the SelectAll results in the contents getting scrolled to the end. I want it to scroll to the front instead - this box is being used with number fields. My question is: is it possible to SelectAll() bu...

Template Binding to background and foreground colors?

I'm building a simple ControlTemplate for a Button. I want to draw a 2 color gradient, and bind the two colors so I don't need to hard code them in the template. But since Background and Foreground are Brushes and not just Colors, I'm not sure this will work. Can anyone tell me if there is a good way to do this? it seems simple enoug...

WindowsFormsHost not showing when Wpf Window style is set

I have a WPF Window that has a WinForms Button inside. When I set the Style of the Window the button isn't rendered, but when the Window Style is not set the Button appears as it should be. Window Xaml: <Window x:Class="Telbit.TeStudio.View.Forms.FloatingTestComponentsBrowser" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/pre...

Adding Properties to Custom WPF Control?

Hey all, I just started WPF this morning so this is (hopefully) an easy question to solve. I've started with creating a button that has a gradient background. I want to declare the gradient start and end colors in the property of the control and then apply them in the template. I'm having trouble getting the code to compile though. ...

WPF new View vs FindResource

We are wiring up our views and view models "externally" meaning we have the following type of code somewhere: var viewModel = new MyViewModel(); var view = Application.Current.FindResource("MyView") as UserControl; view.DataContext = viewModel; That is a paraphrase of sorts. We do this so that the dll containing all of the views can ...

wpf - Datagrid vs ListBox

I'm thinking to convert my desktop wpf Listboxes to DataGrids. My question is: Is there anything I can do in a listbox that I can't do in a datagrid. For example I would like to have templates that will allow me to display data in different ways, 2 up, 4 up etc for the lists. Is this as simple with DataGrids. Thanks for your help. ...

Fixed gradient with a moving rectangle?

I have a WPF 'monitor widget' that displays CPU, RAM and disk performance as small percentage bars. I use the following gradient as a resource to divide the bars into 4 sections (ie. 0% - 25%, 25% - 50%, etc.) <LinearGradientBrush x:Key="Quarters" StartPoint="0,0" EndPoint="0,15" MappingMode="Absolute"> <GradientStop Color="LightGre...

Using WPF Frameworks / Modules in Small Scale Development

I have read quite a few posts on SO and around the web of the benefits and features of various WPF Frameworks (Caliburn, Prism) and Module Frameworks (MEF, Unity) and combining them. In theory, I love the ideas behind them. And I know once I get a grasp on those systems, that it may actually increase development speed - but the upfro...

How do I use content size in Button Template Triggers?

I'm creating a ControlTemplate for a Button. I want to animate the size so it grows to fit the content when the mouse hovers over it. However, I'm not sure how to get the content size in the triggers section. Here is what I have. <ControlTemplate x:Key="buttonTemplate" TargetType="Button"> <Grid Name="grid" Height="12" Width="12" Opa...

Slider maximum minimum changed

Basically I need to do some calculations when the Maximum or Minimum properties change, but there's no event in the Slider control that allows me to look at it when this happens. Any ideas? Thanks! ...

WPF - Where to put DAL in 3-tier architecture design with MVVM?

I'm fairly new to the whole n-tier architecture thing, and I had some questions about using MVVM with a 3-tier application. From my understanding, we have: The View, or UI layer, which is the xaml file The Model, which is a custom class containing properties and methods that "models" the data object The ViewModel, which is the "adapte...

Multiple List-Controls bound to a ViewModel

Is it appropriate to only set the Visibility-property of an unused virtualizing list-control to Collapsed. I have a ViewModel that implements IEnumerable<SomeType> and have some virtualizing list-controls that bind directly to the ViewModel (declared in markup). At a time always only one of the list controls is visible. Is it appropri...

How to use WPF custom control properties in XAML Template?

Hey all, I've created a custom control that is intended to be used as a button but has properties to specify points for a polygon (to be drawn inside the button) and two colors for the gradient. I've declared all the properties in the code and then written the template in the XAML but it doesn't seem to be working. If I hard-code the ...

Can't create items in context menu in WPF editor

I've made a context menu in WPF for my TabItem. But for some reason, it won't allow me to add items to it. I was hoping to pop up a box with options like, close, rename, etc. I've got the Items collection, just everything's greyed out. I'm quite new to WPF and C# so feel free to point out the obvious. I'm in Visual Studio 2010. ...

WPF ListView does not raise SelectionChanged events after the first time the event is raised

I've created a prototype app with a Listview bound to an ObservableCollection programmatically through it's itemsource property. Everything was working well until a day ago when the ListView stopped raising SelectionChanged events after the first time the event is raised. Eg. Select a row in the ListView, SelectionChanged event is raised...

How to resize a polygon in WPF?

Hey all, I'm working on my first WPF application and I'm testing out a custom control that is essential a circle with a play button drawn into the middle of it. I seem to have hit a bit of a hitch though. When I draw my play button I can't seem to get it to resize alongside the circle. Specifically, when I resize the circle to be wid...