wpf

WPF Datatrigger

Why cant i code like this <Border Width="130" Height="70"> <Border.Triggers> <DataTrigger Binding="{Binding Path=CurrentStatus}" Value="0"> <Setter Property="Style" Value="{StaticResource ResourceKey=ListBoxItemBorder}"/> </DataTrigger> <DataTrigger Binding="{Binding Path=CurrentStatus}" Value="200"> <Setter ...

Making input form rotate in 3d using WPF (like silverlight planeprojection)

I am looking at updating the UI of one of my projects that currently uses Winforms and i was hoping to use WPF. I have used silverlight for a while and wanted to use the same PlaneProjection effects to basically rotate my form (by form i mean a group of input controls) along the Y axis. After looking over the interwebs it looks like for...

ObservableCollection<T> and OnCollectionChanged

I was learning about ObservableCollections in WPF and something is not clear to me. I understand that if I bind a control to an ObservableCollection and the collection changes, the control will reflect the changes. My questions are: ObservableCollection implements INotifyCollectionChanged, which is just an event, CollectionChanged. ...

When are DispatcherUnhandledException and AppDomain.UnhandledException insufficient (WPF app)?

I've hooked both of these, but occasionally my app still crashes and just throws up the Windows "an exception has occurred" dialog. When I click OK, the app just exits. Under what circumstances won't exceptions get caught with these two handlers (in a WPF app)? I should mention that I'm doing a bunch of COM interop, so that's always s...

Changing a property in ViewModel making Model unserializable???

Alright I'm a bit baffled by this one. Changing an unrelated int property on my ViewModel seems to be making my Model unserializable. I have an object which tracks the best time to contact someone. It can be set to Anyday, Weekdays, Evenings, SpecificDays and to Anytime, Mornings, Afternoons, Evenings, and SpecificTimes. When the object...

How to use string values in place of ticks on WPF Tickbar?

I wish to customize the appearance of the basic WPF TickBar. I was wondering if there was a simple way to do this using a control template: I wish to have numbers in place of ticks along the tickbar. I want the position of the number to correspond to the value of a slider (much like the picture in the link). I've searched around an...

WPF - Getting a property value from a binding path

Hi, if I have an object say called MyObject, which has a property called MyChild, which itself has a property called Name. How can I get the value of that Name property if all I have is a binding path (i.e. "MyChild.Name"), and a reference to MyObject? MyObject -MyChild -Name ...

WPF, property in ValidationRule never set

I'm trying to bind a property in my DataContext to a property in a ValidationRule: public class ReleaseValidationRule : ValidationRule { // I want to bind a value from my DataContext to this property: public CheckboxViewModels ValidReleases { get; set; } ... } Based on this thread, I created the CheckboxViewModels class ju...

Using WPF custom compositefont from dll resource

Hi, I have a custom composite font as a resource in a library dll that I'd like to load but I'm unable to get the exact syntax. I tried: FontFamily font = new FontFamily( new Uri("pack://application:,,,/MyLibraryDll"), "./fonts/#My Font from composite font"); Which didn't work so I tried enumerating the fonts with: ICollection...

How do I create a WPF ListBox.ItemTemplate with a variable left column and a fixed right column?

My WPF Listbox should have two columns. The one on the right should have a width of say 20 and the left column should 'fill' the rest of the listbox. Here is the listbox definition: <ListBox ItemsSource="{Binding Path=Stuff}"> <ListBox.ItemTemplate> <DataTemplate> <DockPanel LastChildFill="True"> ...

how to disable whole view in wpf

I am working on a WPF application in MVVM pattern. My application consists of 2 modules. The first Module consists of a View. In bottom row of that View I am adding another Region in which another module loads its own View. Issue: whenever user makes any changes in the upper view, the Lower view (loaded by another module) should gets k...

WPF INotifyPropertyChanged for linked read-only properties

I am trying to understand how to update the UI if I have a read-only property that is dependent on another property, so that changes to one property update both UI elements (in this case a textbox and a read-only textbox. For example: public class raz : INotifyPropertyChanged { int _foo; public int foo { get { retu...

Issue adding ribbon buttons directly to quick access toolbar

I am trying to add a Ribbon Button directly to the Quick Access Toolbar by using the CanAddToQuickAccessToolBarDirectly property. I have read in order to do this a command must be enabled on the button from this source (http://blogs.msdn.com/b/llobo/archive/2010/08/06/wpf-ribbon-basics.aspx#comments). When I add a command to the button i...

MVVM Window / Control Operations

I'm building a WPF MVVM application and I'd like to keep what I can conforming to MVVM (I know some stuff is over-engineering, putting a best effort here though). I've run into a small dillema, I need to Hide / Close a window based on some logic in one the the methods in the view model. I can't for the life of me come up with a reliabl...

WPF Binding between Control and Style

I have a control in my XAML bound to a property with a style. <TextBox x:Name="txtCapAmount" Text="{Binding Path=CapAmount}" Style="{DynamicResource AmountTextBoxStyle}" /> In the style I'd like to use the Binding from the control but am not sure how to set it <Style x:Key="AmountTextBoxStyle" TargetType="{x:Type TextBox}"> <E...

String manipulation in XAML property databinding for Hyperlinks

Is there an easy way to transform or format a string as part of WPF data binding? Suppose I want to create a WPF Hyperlink element based on a string tag. <Hyperlink NavigateUri="{Binding Tag}"> <Run Text="{Binding Tag}" /> </Hyperlink> But I need to transform the Tag first for the NavigateUri property to make it a true hyperlink ...

WPF Binding, OneWayToSource, "Property Get method was not found."

I have a public CLR property defined in the code behind of a WPF Window. This property only has a setter defined. public SomeCustomType SomeProperty { set { someValue = value; } } I also have a ComboBox defined in the XAML of this WPF Window. This ComboBox has two ComboBoxItem objects defined. The Content properties of...

Application Settings + DirectoryInfo/FileInfo

I'm still new to C#... I'm building a WPF application and I'm trying to apply some User Application Settings. It's easy to insert standard App Settings (int, double, string, etc). I've even got something like WindowState inserted. I'd like to have a DirectoryInfo and/or FileInfo as savable settings instead of Strings. Selected type:...

DependencyProperty keeps it's value after destruction

Scenario: A VB6 library calls a method in a .NET-Assembly through COM and with that opens a WPF-Dialog, which is contained in another .NET-Assembly that is early bound. This WPF-Dialog got a complex master/detail implementation over a DependencyProperty of type ObservableCollection on this dialog. The DependencyProperty looks something l...

C#: How do I run a batch process after a program exits (not called during it).

I have the following setup: MainApp.exe checks for updates, downloads latest updates. The problem is that sometimes the updates are DLLs that the MainApp.exe is currently using. So, I thought maybe just dump all the files into an Update (temp) folder and when the program exits run a batch file that overwrites the DLLs and then relaunche...