wpf

Number of Objects Resulting from a Loose xaml File

Hello All, Suppose I have a loose xaml file with one resource in it, keyed "MyResource", and that I pull that loose xaml file into two other xaml files via ResourceDictionary.MergedDictionaries. Now suppose I put the following line of code in both of the code-behind files for the two xaml files: object obj = FindResource("MyResource");...

Get WPF resource from code?

What is the simplest way to get a WPF resource from code? I need to disable a text box in a WPF form if a checkbox in the same window is checked. I have wired the checkbox to an event handler in code-behind. The event handler disables the checkbox and changes its background to a light gray, to indicate that the control is disabled: pri...

Dynamically Adding Application Settings in a WPF Application

I have a WPF application that loads different client data based on a setting in a random config file on the machine. I use the client ID read from this config file to load data from a different folder within the application. The data includes a Sql compact database, Images, Videos, etc. The content in the application will change based on...

Populating ListBoxItem Background according to a Bool Member Object

I have a class having a Boolean member and I want to populate a Wpf ListBox with a collection of my class. I want the background of the listboxitem to a different color if my boolean property is false. Is it possible with XAML ? What is the best way to do that ? class Mi { public bool mybool{get;set;} ...

Tricking a Usercontrol to allow "." namespaces...

I have a 3rd party control (Visifire) which has a namespace that uses the "." format. This works fine in a WPF application, but not in a UserControl as it generates a "can't find assembly" if you try to include the namespace. This means I have to use code to add the control, set up the bindings, etc, etc, which is quite annoying as I wou...

Problem with VisualTreeHelper.HitTest in WPF

I'm trying to hit-test a bunch of UserControls on a Canvas. I don't want the HitTest() to walk the whole way through the visual tree, so I'm using the FilterCallback to make sure I only hit-test the UserControl. My problem is that the UserControl never hits, it should, but it doesn't. If I use the FilterCallback, I return that it hit ...

About Window or About Box in WPF 3.5 (VS2008)

Hello All, I am looking for About Window for WPF VS2008. Any Source code is available to download or one have to develop on his/her own. Thanks you, Harsha ...

databinding to data still being processed on another thread in wpf

Just wondered what that best approach is for this scenario - trying to databind to a collection which is being populated in another background thread. My background thread is adding items to the collection in a processing loop which may run for several minutes. Every now and then it raises an event to the UI and passes a reference to t...

wpf: override label content when currently bound item is null

I want to set a label (or textbox) default string as long as the binding value is null. This works fine for any other property than content, for example: <Label Content="{Binding Source={StaticResource pumpCurvesViewSource}, Path=/Label}"> <Label.ContentStringFormat>Details for pump curve: {0}</Label.ContentStringFor...

WPf Exception - Grid.Effect

Hi, I'm getting exception when I put below code in Visual Studio -2008 Code editor.Pls let me know how can I tackle this exception.And my visual studio is getting crashed on reload. <Grid Background="WhiteSmoke" Height="262" Width="257"> <Grid.Effect> <DropShadowEffect ShadowDepth="2"/> </Grid.Effect> </Grid> Excepti...

wpf converter binding problem

I am trying to bind a combobox with the Tabitems using converter My converter class is as follows public class TabItemsCollection : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { ItemCollection collection = value as ItemCollection; ...

How to simulate Paste in a WPF TextBox?

I have a TextBox in my WPF application which I've added a Paste event to using: DataObject.AddPastingHandler(elm, new DataObjectPastingEventHandler(OnPaste)); Now I want to trigger the OnPaste event from C# code. How can I do this? I tried calling the Paste() function on the control. The text is pasted in the control, but the OnPaste...

Silverlight open file from server

I have task to give in my application possibility to open document that is located on server, but I dont know at all how to implement this. Please give the main idea how can i do this? ...

WPF and Powershell - Handling events

Can anyone point me in the right direction for some documentation about handling WPF UI events in Powershell? I want to know how to, for example, call a function when a CheckBox or Radio Button is changed. Cheers! Ben ...

ClickOnce incorrectly detecting newer version form server

Hi There, I have a ClickOnce application that checks a server for a new version on startup. I recently deployed a new version (2.0.0.0) whilst leaving the old version (1.9.9.9) on the server. On startup version 2 will inform the user that a new version of available and download 1.9.9.9. Is there a reason this could be happening? I ass...

How can I run a WPF application in a new AppDomain? ExecuteAssembly fails.

Hi. I'm trying to launch a WPF application from a Console application, using Application Domains, but when I do, I receive unexpected errors. Running the WPF application standalone, works. This code works, too: var baseDirectory = AppDomain.CurrentDomain.BaseDirectory; var path = string.Format("{0}AddressbookDesktop.exe", baseDirecto...

Executing viewmodels command on enter in TextBox

Hi. I want to execute a command in my viewmodel when the user presses enter in a TextBox. The command works when bound to a button. <Button Content="Add" Command="{Binding Path=AddCommand}" /> But I can't bring it to work from the TextBox. I tried an Inputbinding, but it didn't work. <TextBox.InputBindings> <KeyBinding Command="{...

How can I move a storyboard from a button to a style I can apply to all buttons in WPF?

Got a bog standard button with a style that sets its margin. I followed a tutorial to add animation to it, but I want to move this into the style so I can apply the same animation to all my buttons. I've tried a few ways but without any success, could anyone point me in the right direction? <Button Name="btn7" Grid.Column="2" Grid.Row=...

WPF: Control Visibility from Database / Prerender Hook

Hi, we have a rather odd requirement: The visibility of any control in our WPF-Application is to be driven by a database-table. That means we have a table which stores the name of the element and its visiblity. Now I am looking for an elegant way to implement this feature on the client side. I could create my own UserControl and inh...

How to create notification control using MVVM?

Hi. I'm creating my first application using MVVM. I'd like to have a usercontrol that shows the results of some functions. Something like VS Error List. I.E. if I choose some xml file in some other usercontrol and try to deserialize it, I'd like to have on this notification list some info like "Deserialization complete" or "Deserializ...