wpf

When to use value converters in a mvvm application?

Hi! If one is implementing a WPF application using the MVVM design pattern, is there any situation in which to use value converters? It seems to me that value converters do exactly the same what the view model does too, that is preparing data for the view. So, are there some good uses for value converters? Best Regards Oliver Hanappi ...

Threads after closing MainWindow wpf

Hi I have noticed when i run the VS.Net 2008 in debug mode after closing my mainwindow the debug mode used to stop automatically. But recently i have been using Threads and noticed after the main window closes VS.Net continues to stay in debug mode. Just wondering if this is expected or am i doing something wrong. Also in TaskManager the...

WPF: How to bind to different objects?

I have a ListBox containing CheckBoxes. Xaml looks like this: <ListBox x:Name="lbContactTypes"> <ListBox.ItemTemplate> <HierarchicalDataTemplate> <CheckBox Content="{Binding Path=Description}" IsChecked="{Binding Path=ContactTypes, Converter={x:Static Classes:ListContainsConverter.Instance}, ConverterParameter=1}...

How to call a user control method using MVVM?

Hi, I'm working in a WPF project, I'm using the MVVM patter in my project. I created a user control (also in WPF) and I want to use it in my project, now, my problem is that I have a method in my user control that I need to call from my View Model, but I don't know how to do that, how to bind to the method inside my control from the vie...

TabControl disposes of controls on inactive tabs

I'm using the MVVM pattern for my app. The MainWindow comprises a TabControl with the DataContext mapped to the ViewModel: <Window.Resources> <ResourceDictionary> <DataTemplate x:Key="templateMainTabControl"> <ContentPresenter Content="{Binding Path=DisplayName}" /> </DataTemplate> <local:ViewModel x:Key="VM" /> ...

[WPF] ToolTip placement's bug with multimonitor?

I'd like to aligns the tooltip's lower edge with the upper edge of the PlacementTarget, and align the tooltip's left edge with mouse position, I have two screen, both 1920 x 1080, when I ran the program in the main screen, the tooltip jump to the second screen when mouse's x position larger than 770, if I ran it in the second screen...

Error handling patterns for multithreaded apps using WF?

I was writing up a long, detailed question, but just scrapped it in favor of a simpler question that I didn't find an answer to here. Brief app description: I have a WPF app that spawns several threads, and each thread executes its own WF. What are some of the best ways to handle errors in the threads and WF that will allow user inte...

Default values in WPF DataBinding ?

Can we set default values in WPF DataBinding? e.g : I've bound the Height and Width of my window to some properties as follows. <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" x...

C# WPF - ComboBox highlighting text colour issue

I have an issue with ComboBox highlighting which shows black text on a blue background, when the text for highlighting should be white. I have examples of ComboBox which use ComboBoxItems where the Content is a string. The combobox in these cases behave as expected - when the combobox is dropped down if you highlight an item it display...

WPF Datagrid virtualization and auto height (not explicit).

I am trying to design a view with a datagrid a grid splitter and a bottom panel that contains some messages. Something like: <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="10"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <toolkit:DataGrid Grid.Row="0" {deta...

WPF: Is there a way to get original values in ConvertBack method of MultiValueConverter?

I've written a MultiValueConverter which checks if a given list contains a given value and returns true if it does. I use it for binding to custom checkbox list. Now I'd like to write ConvertBack method so that if checkbox was checked, original value would be sent to the model. Is there a way to access values in ConvertBack method? XAML...

How to discrete animate GridLength from "Auto" to "*"?

I need to animate this property using a Storyboard. Is writing your own animation is a best choice? ...

WPF: Using bindings in data trigger condition

Let's say I have the following simple classes: public class Person { public int Id { get; set; } public string Name { get; set; } } public class PersonHolder { public Person CurrentPerson { get; set; } public int ActiveId { get; set; } } Now I have a grid with an instance of class PersonHolder as DataContext, and in ...

Can/how do you host a full VB6 Form in a C# WPF app?

I am currently exploring the option of porting some older VB6 application to WPF with C#. The plan, in phase one, is to port several key forms and not all the application. The theoretical goal is to open the VB6 form in a container of some sort within WPF via an ActiveX dll. Is this even possible? I've tried looking at the Interop and c...

Bold/Color dates in Telerik RadCalendar/WPFToolkit Calendar

How can I bold or change the color of the date in a RadCalendar/Calendar. I recently switched over to WPF and I find no AddBoldedDate(DateTime dt)? ...

What are the different triggers in WPF?

What are the different triggers in WPF? How do they differ and when should I use them? I've seen the following triggers: Trigger DataTrigger MultiTrigger MultiDataTrigger EventTrigger ...

Decouple the screens without magic strings

My WPF project will be organised like this : Screens Group1 Screen1 View.xaml ViewModel.cs Group2 Screen2 View.xaml ViewModel.cs To show the Screen1 from the Screen2 I'll use something like this: ScreenManager.Show("Group1.Screen1") This looks (using reflection) in the Screens.Grou...

Listbox ItemTemplate - Binding to xml attribute value

I am trying to bind the value of the ItemTemplate on a listbox to an attribute in my xml data. The attribute value will match the key of a data template I have defined elsewhere. When I try the following I don't get any build errors but nothing shows up in the ItemContainer (its obviously not associating the value of the node with a res...

Commanding in MVVM (WPF)--how to return a value?

I've been using MVVM pattern for a while now, but I still run into problems in real-life situations. Here's another one: I use commanding and bubble up the event to be handled in the ViewModel. So far, so good. But the project for which I'm using MVVM is actually a class library. Once I run the command code, I need to be able to send...

Localized System.Windows.Media.Color name

The standard color names are english names, ok. But my Application is german so I would like to have the color names in my ComboBox as german names. Instead of "Blue", "Yellow", etc. I would like to have "Blau", "Gelb", etc. Is there a function that returns all localized names? Or is it that easy that I change the culture in this call? ...