wpf

How to bind to DataGrid in WPF

Hi I tried to understand but failed. In WinForms I can build up some rows in a datagridview. By using Application.DoEvents (not nice but works) I can see how it is building up also when the list is very huge. I just want some similar in WPF. Here is my project: http://www.goldengel.ch/temp/FileContent%20Replacer.zip I already posted...

How to Bind CLR Object to ListBox or DataGrid using Microsoft Expression Blend?

I have successfully created my data source, which is a CLR object of the class Person. Person class has a bunch of public properties, such as Name, Emails, Phones, etc. I want to data bind person's emails (there's more than one email) to DataGrid or ListBox controls. I want to be able to choose which fields of the email I want to show ...

Blend 4 trigger rendering not working

Ive got a really frustrating bug going on with Blend 4, when i edit a control template with triggers, if i switch to one of the triggers, the trigger changes are not shown in the design pane, its like ive turned off trigger rendering somehow Reproduction Steps Create a new WPF application in visual studio 2010 Open new solution in blen...

Image and TextBlock in WPF RibbonApplicationMenu

Hi, I need to put an image and text to WPF Ribbon Menu. I have tried few things but all I can get are empty buttons in Ribbon Menu. I am using .NET framework 3.5. Part of my not working code is here: <r:Ribbon.ApplicationMenu> <r:RibbonApplicationMenu Command="{StaticResource ApplicationMenuCommand}"> <r:RibbonA...

Embed a Console Window inside a WPF Window

Is it possible to embed a console window inside a WPF window? As a little background, at first I tried to implement a console window from scratch in WPF, which was successful except for one huge problem -- its extremely slow. See the question here: http://stackoverflow.com/questions/3219819/vt100-terminal-emulation-in-windows-wpf-or-sil...

Dispatcher.Invoke with anonymous delegate works in Silverlight but not WPF

In Silverlight 4 I have a custom service class which has an asynchronous Completed event. Inside the Completed event I take the returned data and invoke a populate method via something like this: private void service_Completed(object sender, CompletedEventArgs args) { Dispatcher.BeginInvoke(() => populateInbox(args.Jobs)); } priva...

WPF Designer ONLY: NullReferenceException when loading connection string from app.config

Please help, for the sake of my non-pulled out hair... The following code line: this._connectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString; is causing me untold amounts of grief. It is in a user control, currently in the control's Loaded event but I've also tried the constructor and just...

How to do Regions in WPF without Prism?

Specifically in MVVM Light toolkit? I've not dove into the Prism code yet to see what it does in regard to regions in a WPF UI. Seems like with the messaging and the ViewModelLocator in MVVM Light you could do a similar thing....Can you? Can anyone give some examples on how you could do this? Essentially I'd like to click on a button...

what would be the max event updates/sec to a C# WPF app I should allow

I'm going to have quite a few event updates to a C# WPF GUI coming through from a class library I have - I'm thinking I should probably throttle the number of events that can get through per second, so: 1) Any rule of thumb re how many UI changes update events one should allow through per second? (e.g 10 per seconds say) - in my case th...

Is there a way to define WPF custom bindings?

WPF already defines Binding and TemplateBinding. Is there a way to define my own custom binding type. For example, could I declare a "SelfBinding" where RelativeSource == RelativeSource.Self? ...

What is the intended way to make a label and text box side by side in WPF?

I'll often use this: <StackPanel> <StackPanel Orientation="Horizontal"> <Label>Username:</Label> <TextBox /> </StackPanel> <StackPanel Orientation="Horizontal"> <Label>Password:</Label> <PasswordBox /> </StackPanel> </StackPanel> But it is such a common scenario, I feel like there is a way with less markup. A...

WPF Ptterns - Which one should I learn

Hi, I have got programming experience using the MVC pattern on web applications, I am planing to implement an application to learn WPF, which pattern should I apply? Which one is the most used? Thanks ...

Updating the styling of a WPF DataGrid and forcing a refresh

Hello, I'm using an IValueConverter in conjunction with DataTriggers (all in code, not XAML) to implement conditional styling for a WPF DataGrid (from codeplex.com). I have all the code in place, but when I update the styling (after obtaining some values from form elements) the datagrid does not update the display of the elements. I h...

wpf ribbon control with custom controls

Hello This control has been in pre-release so long I was wondering: 1) is anyone using it for production apps or do you buy 3rd party? 2) how much of your ribbon do you typically do in code vs. xaml? 3) can you put custom / user controls inside of it? 4) any favorite helpful links and / or caveats? Cheers, Berryl I just found this ...

WPF DevComponents TabNavigation inability to change SelectedIndex/Item in code-behind.

I am using the DevComponents TabNavigation control for WPF, and am able to add a new TabItem to the TabNavigation at a specific index, call it i, in the code-behind. Now I want to make the new TabItem the SelectedItem, by doing: private void textBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { int i = createNewTabI...

WPF: Is there a way to bind to a Nullable<Int32> property without using a value converter?

Is there a way to bind to a Nullable property without using a value converter? Currently I have this... <DataGridTextColumn Header="ApplicationKey" Binding="{Binding ApplicationKey, ValidatesOnDataErrors=True, Converter={StaticResource ResourceKey=TestConverter}}" /> Without the converter it thinks of an empty textbox as a String.Emp...

How do I convert a WPF size to physical pixels?

What's the best way to convert a WPF (resolution-independent) width and height to physical screen pixels? I'm showing WPF content in a WinForms Form (via ElementHost) and trying to work out some sizing logic. I've got it working fine when the OS is running at the default 96 dpi. But it won't work when the OS is set to 120 dpi or some ot...

BindingGroup with multiple (failing) ValidationRules

I ran into a problem today at work wherein I have a BindingGroup that has multiple ValidationRules that are failing simultaneously. Problem is, I get an ArgumentException bubbling up from withing BindingGroup.ValidateWithoutUpdate when I try and determine if there are any errors (i.e. to set the CanExecute on a command to false). I've m...

How to draw none fuzzy/blurry line in DrawingImage/DrawingContext ?

See the image. I would like the middle line to be a crispy 1 pixel line. You can copy and paste the sample markup into kaxaml . <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Image SnapsToDevicePixels="True" Stretch="None"> <Image.Source> ...

Strategies for keeping a .NET alt-tab replacement responsive after a long period of non-use?

I'm working on a simple alt-tab replacement program. It's implemented in C# as a hidden WPF window that's brought to the foreground by a global keyboard hotkey. For the most part this works great, and the application window appears immediately after the hotkey is pressed. However, if it has been a long time since the user has activa...