wpf

Attacks on WPF applications

What attacks or security vulnerabilities are specific to WPF applications? To clarify, I'm not asking how to do SQL Injection on WPF apps, or what kind of crypto should I use, or... I'm also not specifically asking about flaws in the Framework, or in WPF itself, rather flaws that might manifest based on improper implementation. Very spec...

Override general Button style

We have a general style in default.xaml, targeting all buttons in our application. Is there a way to override this style, and creating a new button based on the default button? ...

How to set TAborder in wpf

hello all i have a problem i make a wpf application its running well.but i want to set the tab order of each my form but i don't get any taborder in Vs2008 express edition how can i solve this is any body help me thanks in advance shashank ...

Binding to UserControl property inside tooltip not working

Hello, I am trying to do some simple binding to a property inside my usercontrol. Does anyone know why this doesn't work? It works when the TextBlock is outside the Tooltip. Thanks! MasterPage.cs: MyUserControlInstance.DisplayName = "Test"; MyUserControl.xaml <ToolTipService.ToolTip> <ToolTip Template="{StaticResource ToolTipT...

WPF ComboBox Auto Select If Only 1 Item

I have a combo box that I bind to an observable collection, which gets changed (according to company selected) and a large number of companies will have a single account (the items) therefore I want to know what the best way to make the ComboBox set the SelectedItem if there is only 1 item in the ItemsSource, otherwise leave it as null t...

Focus on TextBox when UserControl change Visibility

I have a usercontrol loaded inside a canvas; this usercontrol on default have visibility collapsed. When a specific textbox of my window is focused the usercontrol become visible. When usercontrol become visible I want set focus to another textbox inside usercontrol. I try to do that: private void UserControl_IsVisibleChanged(object s...

Showing SelectedItem Details to its side

I've a ListView bound to an ObservableCollection<Foo>. On selecting a ListViewItem I display the details of the SelectedItem(Foo members) in a container. It works fine. Now all I want is to display the details just next to the SelectedItem. ie, If I select the fourth ListViewItem then the Container's Top should be the same as the ListVi...

How does IDataErrorInfo work?

I'm currently looking into validation for my WPF app and seen the mention of IDataErrorInfo. However there are few guides to how to use it and worse there are none who explain how it works. On MSND.com site this is givin' MSDN public class Person : IDataErrorInfo { private int age; public int Age { get { return ag...

Text box key up event in WPF

How to use ICommand in key up event of a text box using MVVM architecture? ...

[WPF] Binding where value changes are directly stored in the DB

Hi, I'm currently struggling with one of the bindings I'm trying to add to my WPF project. In the app I have a model with a bool property that cannot be used for databinding. Behind that property is a .NET remoting object that does some validation and writes the new value into the DB. The requirement ist that the property should be dis...

How to automatically update UI when items are added to List<>

Wihtin my current project I have to add data items to a List<> object. I am using a list due to the fact that it is being derived from an external type and due to how it is being utilized by other applications I do not have the ability to request that the type be changed in the assembly from List to ObservableCollection. So as of right n...

Emptying WPF datagrid in codebehind

In WPF, I am using the DataGrid from WPF toolkit.Can anyone tell me how can i empty the data in the datagrid in codebehind ? ...

WPF binding to nested objects in a ResourceDictionary

I have an object tree which is included in a ResourceDictionary in my application. The root node of this object tree has an x:Key associated with it. I want to bind a control to a property of one of the nested items in this tree. How can I get access to a child element of a keyed ResourceDictionary to allow me to do this? ...

How do I implement WPF group box than spans two columns?

Here is the layout I want: Grid with 2 columns, 2 rows Row 1 should contain a group box that spans both columns. Row 2, Column 1 will contain a group box Row 2, Column 2 will contain another group box. In row 1's group box, I want the left side to have a stack of labels/combo boxes. On the right side will be a stack of labels/checkbo...

WPF ComboBox and SelectedItem Binding to XML DataSource

Hi All, I have a comboBox inside a DataTemplate as below:- <ComboBox x:Name="cboImages" Grid.Row="1" Grid.Column="1" SelectedItem="{Binding XPath=ImageName, Path=SelectedItem.Content, Mode=TwoWay}" IsSynchronizedWithCurrentItem="True" > <ComboBoxItem>Image1.jpg</ComboBoxItem> <ComboBoxItem>Image2.jpg</ComboBoxItem> <ComboBoxItem>Image3...

TextBox loses focus on Key Command

Hi, In my WPF application I have a text box control. The text box control is located in a UserControl which in turn has a View Model class. In my VM class I have a Command, which get executed either when a button is clicked in UserControl or when the Enter key is pressed. My problem is that when I press Enter, the text box loses focus a...

DataBinding to a Listview

Hi, I have a listview which I have binded (twoWay) to a datatable. The binding works fine and data is coming up properly on the listview. Now what I want to achieve is a bit complex and I am not even sure whether this can be achieved or now. My datatable has say 15 columns, and I am showing 5 columns in the lisview. Is it possible that...

In WPF how to bind a collection within the parent control's itemssource.

I'm new to WPF so this may be easier than it seems. I have a DataTable object that I set as the itemssource of a combobox. For each row in the DataTable I want a ComboBoxItem. For each ComboBoxItem I want to create a label for every column name and a text box for the corresponding value, in the current row, of that column. Nothing I try ...

Extensible WPF application - MEF, MAF or simple loading?

(I know about the other MEF/MAF questions but this is a more specific problem) I want to create a WPF application that will basically be just a simple add-in host, GUI and settings. All of the actual work will be done by one or more plugin(s). They don't need to communicate between each other, the main application will send user input/c...

Simplifying RelayCommand/DelegateCommand in WPF MVVM ViewModels

If you're doing MVVM and using commands, you'll often see ICommand properties on the ViewModel that are backed by private RelayCommand or DelegateCommand fields, like this example from the original MVVM article on MSDN: RelayCommand _saveCommand; public ICommand SaveCommand { get { if (_saveCommand == null) { ...