wpf

How do you validate the data in your ViewModel in the MVVM pattern?

I listened to this herding code podcast on MVC, MVP, MVVM yesterday and was struck by the idea of sending your whole ViewModel object to a validator which does nothing but validate all the fields in it and send it back. has anyone implemented that type of validation pattern? how did it look technically? I am thinking of extending thi...

How to disable default TextInputPanel for an application?

Hi all, I have a wpf application (I use CAL) for a tablet pc. I created a custom text input panel. Now is my question: How can I disable the default TextInputPanel? This is only through my application offcourse because I still want the utility in my winxp and other apps on the tablet. The problem is that when I hover to long near...

Refresh Page In wpf

How to close or cancel the pop up window in Button click.? When i update the data in pop up window, the same time how to refresh the datagrid in main page.? Thanking u ...

MVVM Dependencies between View and ViewModel

Currently there are a lot of variations on the MVVM design pattern but as I understand it the view is allowed to have dependencies on the viewmodel. A colleague of mine disagrees but he couldn't provide a satisfactory explanation. E.g. my views contain a reference to their viewmodel. This is not needed for all views but it helps when co...

How to invoke windows theme in WPF?

Hi Folks I am trying to invoke the current theme of windows for my elements in WPF 3.5. as the user change the window theme my application should also be changed according to the theme. I am using styles. Please help me. ...

WPF Page refresh

1.How to close or cancel the pop up window in Button click.? When i update the data in pop up window, the same time how to refresh the datagrid in main page.? ...

ReflectionPermission Exception

I am currently working on an application using WPF and MVVM. Now if i go to another user's machine and try to launch my app, i get an Exception due to missing ReflectionPermission at BindToMethodInfo(Object, RuntimeMethodHandle, RuntimeTypeHandle, DelegateBindingFlags) in mscorlib. Now my question is, what exactly requires the Reflectio...

MVVM in a canvas with usercontrols

I have a MVVM WPF application that basically wants to be a single line diagram designer for an electrical distribution network. I have a canvas that must contains transformers, circuit breaker, lines and cables. My big problem is the design... How can i start? I think about a DesignerView, DesignerViewModel that contains an Observable...

How to implement a multi-platform multimedia application?

On which technological basis would you implement a multimedia app, which has to meet the following requirements: Platforms: Windows XP/Vista, Mac OS X, Linux (nice to have) Should play audio (mp3) and video (H.264 would be great) from local disk I looked into things like Cocotron which is a cross-platform Objective-C API similar to C...

Should I create a WCF connection once for my whole app, or for once for each page?

I'm working on an application that uses WPF and WCF. As it stands now, for each WPF page, a WCF connection is created for that page to use. Is this good practice? Or should I create a Singleton object to contain a WCF connection that's passed around to my pages as needed? Thanks! ...

Has someone created a WPF Toolbar-Control in Vista/Win7 look ?

I would like to add a toolbar, that looks like the one in the Windows 7 Explorer (see picture below), to a WPF-application. Because I'm new to WPF I wondered if there is a WPF-Control (free / open source) I can use instead of having to create a new one. I already searched for it but could not find anything useful. ...

Is there a way to programatically close a menuitem in WPF

I have a menu in wpf that has an input box and a button on it. Once the user clicks the button I need to close the menu. Is there a way to do this? <Menu x:Name="MainMenu"> <MenuItem Header="Main"> <MenuItem Header="SubMenu" x:Name="SubMenu"> <StackPanel Orientation="Horizontal"> ...

WPF data-binding manual update

I have a List<Foo> from a non-WPF assembly which I'm attempting to databind to a WPF <ListBox>. Initially, the list items display correctly, but when I add a new item to the List<Foo>, the listbox doesn't add a list item. How do I tell the list box to re-bind / update / refresh the data and show the new item? (n.b. complete WPF n00b) ...

Can I update WPF StatusBar text before making the user wait?

I've got a WPF application with a status bar. <StatusBar Grid.Row="1" Height="23" Name="StatusBar1" VerticalAlignment="Bottom"> <TextBlock Name="TextBlockStatus" /> </StatusBar> I'd like to display text there and switch to the hourglass Wait cursor when I do a small amount of work. This code will ...

Hiding Popup control when other window's in focus

I have a custom UserControl which tries to recreate auto-complete for a textbox. When user types, the text is used to filter a provided collection of items and then a Popup displays a ListBox with items that match what user have typed. Unfortunately, if user decides to switch away from the application to another window (browser, MSWord,...

Why is my TypeConverter not called?

I've applied a TypeConverterAttribute attribute to a property on my WPF FrameworkElement subclass. The property is of type BitmapSource. But the TypeConverter is never created or called. Is this because the TypeConverter specified on ImageSource takes precedence? I'm trying to debug a data binding problem. The error message, never make...

What's the simplest way to bind a list of checkboxes to a list of checked values

I have a list of AvailableItems that I want to display as a list of checkboxes, so that users can pick which items to generate, which are then stored in another list called ItemsToGenerate (my lists are actually just lists of strings). Showing all available items with corresponding checkboxes is easy: <ItemsControl ItemsSource="{Bindi...

Refresh WPF Command

Does anyone know how I can force CanExecute to get called on a custom command (Josh Smith's RelayCommand)? Typically, CanExecute is called whenever interaction occurs on the UI. If I click something, my commands are updated. I have a situation where the condition for CanExecute is getting turned on/off by a timer behind the scenes. Be...

How do I specify the name of my application's App.config file in WPF?

This is very frustrating... I can set the Configuration File for a Windows Forms Application just fine. Consider this: public static void Main(){ AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", @"SharedAppConfig.config"); //do other things } However, in a WPF application, this doesn't seem to work! If I set this value, the ...

Silverlight/WPF set elipse with hexadecimal colour

I am trying to set a colour of an elipse object in code behind. So far I'm doing it by using the SolidColorBrush method. Wonder if there is a way to insert the colour value in hexadecimal, like in css. Here is a code that I am using: ellipse.Fill = new SolidColorBrush(Colors.Yellow); ...