wpf

How to bind a TextBox to plain string collection

As a part of large data model I need to display/edit a string collection defined like ObservableCollection<String>. In prototype app we use a list view to display entire of collection and a text box to edit selected element. The text box should be bound to the current element of the collection. Because GUI is subject to change I can't bi...

Defining TextEdit DependencyProperty

Hello, I try to define TextEdit DependencyProperty, because I want to get a TextEdit "Text" value, which was inputed by user. Then I want to use this value in another static class, which forms an SQL query depending on that entered "Text". My Dependency Property: public class FrameworkElement : UIElement { public static read...

Walk the Model3DGroup tree!

I have a complex 3D scene consisting of Model3DGroups that I need to analyze at runtime. Since Mode3D nodes do not participate neither in the VisualTree nor in the LogicalTree is there any other way I can find the parent of a Model3DGroup? ...

Property binding across controls in WPF

I have two UserControls that I want to display in a Window. The value of the property "SelectedItem" of the first UserControl should be set to the second UserControl's "SelectedItem" property. How do I do this? In my current code, the value set in the first UserControl's property does not trigger an update in the second UserControl. I h...

WPF , Getting verticalstretch working as expected!

I am trying to make the vertical stretch to work as expected i WPF, but for some reason it only takes the space it needs, and not the space available. First, I am using WPF with C#, and Prism. In the Shell.xaml (main xaml for the application) I have a grid with 2 columns and one row. The idea is to have a side panel and a main app are...

Error Provider in WPF

Hi, I am looking at WPF componenents in the toolbox but I cannot find the error provider that is present in 2005/2008. Is it removed? ...

WPF design-time context menu

I am trying to create a custom wpf control, I'm wondering how I can add some design-time features. I've googled and can't seem to get to my goal. So here's my simple question, how can I add an entry to the design-time context menu for my WPF usercontrol? The context menu by default has entries View Code,View XAML, etc. ...

WPF/Silverlight: data binding a datacontext to a property programmatically.

I've got some code which sets up a datacontext. Often enough, the datacontext should be set to some underlying data collection, such as an ObservableCollection - but occasionally I'd like to set it to a collection that is itself a dependency property. This can be done in xaml, but doing so defeats the purpose, which is to share the UI ...

WPF Expander Border Animation affects all contained controls?

I'm using a WPF Expander to display a number of analog process variables. I want to make the expander's border 'glow' (or flash) when one of these variables enters a 'warning' or 'alarm' state. To achieve this, I'm using some data triggers bound to a couple of boolean properties in my view model ('AnalogWarningActive' and 'AnalogAl...

How do WPF Markup Extensions raise compile errors?

Certain markup extensions raise compile errors. For example StaticExtension (x:Static) raises a compile error if the referenced class cannot be found. Anyone know the mechanism for this? Is it baked into the XAML compiler or is such functionaility available to custom markup extensions? EDIT: mfeingold below suggested that I need to look...

WPF - MVVM - NHibernate Validation

Hi, Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on the domain object as below. private decimal _refurbishmentFee; [Min(Value=0), NotNull] public decimal RefurbishmentFee { get { r...

WPF: writing smoke tests using ViewModels

I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to use ViewModels directly (after all the viewmodels were created to make unit testing easier in a first place). ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing? ...

How do I update the ItemsSource for a WPF ComboBox without losing the Text typed into the ComboBox

I have a WPF ComboBox (IsEditable = True) that is being populated with items based on the Text entered. I have a property that is bound to ItemsSource. This property is updated in a KeyUp event handler on the ComboBox. The issue I'm having is that when all the text is selected and a new key is pressed - replacing all the highlighted...

Displaying spinner waiting indicator while loading web page

Hi I have a WPF application that is loading web pages. Some of the web pages taking long time. I want to display an indicator like spinner I have the spinner already and using it in other places of the WPF using the storyboard animation of the WPF. The question is, can I use it in the web browser control? Can you let the web browser con...

Difference Between Value attribute and explicit DataTrigger.Value in ResourceDictionary?

Can anyone tell me why the following doesn't work, but the one after it does? Notice the Value= syntax versus the explicit usage on the latter. I don't understand the difference. <Style.Triggers> <DataTrigger Binding="{Binding ItemType}" Value="{x:Type log:FranchiseAiring}"> <Setter Property="Template" Value="{StaticResource...

Display XML in a WPF textbox

It is simple enough to put the outer text of an XML node in a WPF text box. But is there a way to get the text box to format the text as an XML document? Is there a different control that does that? ...

Properly handling exceptions thrown in a thread or via the WPF dispatcher.

When a thread throws an exception that is unhandled, it terminates. What is the proper way to handle exceptions thrown on threads and how to propogate relevant exception data to other parts of the code that would need to subscribe to notifications? Is there an INotifyThreadPoorlyDesigned interface that I missed somewhere? Same applies ...

Value Converter Problems with Infragistics 9.2 XamDataGrid

Hello All, I am having a value converter problem with the Infragistics 9.2 XamDataGrid. Please consider the following code: public class ToolTipFromThreatTypeConverter : IValueConverter { public object Convert( object value, Type targetType, object parameter, System.Globalization.Cult...

Highlight TextBlock only in TreeViewItem with Image

So I have a TreeViewItem that has the following style: <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="HeaderTemplate"> <Setter.Value> <DataTemplate> <StackPanel Orientation="Horizontal"...