wpf-binding

Exapand wpf menu depending on situation

How can I customize the menu to the situation in WPF? I have a main window with a basic menu. In this window, I can load different UserControls and then I want the menu to be expanded with different menu options depending on which User Control is used. In addition, I wonder how I add a MRU. Example: Main menu: File Open - MR...

Pause bindings for entire window?

Is there any way to pause all of the bindings on a window, or pause all bindings in the entire program at runtime? I have a class called Page, it contains a lot of variables that my controls bind to in order to update and be updated by the class. I have a load function that loads an XML file and creates a Page class from it. The problem...

WPF how to bind gridview ?

i am doing this xaml : <StackPanel Margin="320,0,0,0" Grid.RowSpan="2"> <ListView ItemsSource="{Binding employeeCollection}"> <ListView.View> <GridView> <GridViewColumn Header="Employee ID" DisplayMemberBinding="{Binding Path=EmployeeID}"/> <GridViewColumn Hea...

wpf my UI doesnt refrash

my xml is : <Window.Resources> <Style TargetType="ListViewItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> </Style> </Window.Resources> <Grid > <Grid.ColumnDefinitions> <ColumnDefinition Width="381*" /> <ColumnDefinition Width="20*" /> <ColumnDefinition Width="101*"...

How to assign Listbox name and Uri source to the listboxitems from xml?

The idea is to have a listbox which will be generated from xml. Each item will have "name" and "UriLink". I need to navigate to the pages on click on the listboxitem. How can I populate name and UriLink using xml and assign it to listbox items. I was experimented with it but it seems like I am missing something. Thank you in advance. ...

WPF Databinding - bind Visibility to different source than DataContext

(I'll explain the problem once I show my ViewModels and Views) I have two ViewModels: public class CommandViewModel { public string DisplayName { get; set; } public ICommand Command { get; set; } } and public class SomeViewModel : INotifyPropertyChanged { private bool someFlag; private CommandViewModel someCommand; ...

How to get only modified Items from WPF Data Grid

Hi, I have binded a list with Editable WPF DataGrid I want to get only the modified Items from the WPF Data Grid for updation. Please let me know how to do this. ...

Controls available on WPF tab are not getting displayed

I am new to WPF and facing some wierd issue. I have designed a screen having a tab control. Tab control has two tabs and each tab item has few controls on it. The issue is; When I open same solution from different machine I am not able to navigate between these two tabs in design time but on machine (on which I have designed screen) it ...

When to use a WPF Dependency Property versus INotifyPropertyChanged

Do folks have any guidance on when a simple .NET property that fires INotifyPropertyChanged.PropertyChanged is sufficient in a view model? Then when do you want to move up to a full blown dependency property? Or are the DPs intended primarily for views? ...

Set to current item in Combo Box WPF

I am trying to update a MySQL entry in WPF. So I have a list of Tenant names in a combobox and when you click on the Combobox I want to put the first and last name in the textbox. So I have an SelectionChanged event and I try to set a string to cboTenantName.Text which is actually the previous selection and not the current. Now, when I t...

WPF/XAML TreeView doesn't Hightlight Nodes after Binding

So I am having an issue with the TreeView. If I build a tree view statically, every node in the tree is selectable in that when I click on it, it highlights itself blue, indicating that node is selected. <TreeView Grid.Column="0" Grid.Row="2" MinHeight="100" MinWidth="100" BorderBrush="White" DataContext="{Bind...

Find Bound Item from TreeViewItem from ContextMenu

I have this Tree View that looks like this: <TreeView Grid.Column="0" Grid.Row="2" MinHeight="100" MinWidth="100" BorderBrush="White" DataContext="{Binding Projects, Source={x:Static SizingApp:Manager.Instance}}"> <T...

WPF Binding a List<custom> to a combobox in C# code?

Hello, so I have a custom class in a list. I can't seem to get the list and a combobox to bind though. The list should display all the name values of the customclass. I want to do this in code. Any help most appreciated (as ever!). It's best if I give some code snippets I think. The class: public class Asset : IComparable<Asset> { ...

How do I databind a collection to a listbox in WPF?

I have class Employee which is something like this. class Emp { int EmpID; string EmpName; string ProjectName; } I have a list<employee> empList populated and want to show it inside the list box. I set the itemsource property of the listbox to the empList and my XAML code is as fo...

Binding Observable Collection to multiple wpf trees

Does anyone have suggestions on the best way to bind an observable collection to multiple wpf trees using different groupings? Both bindings are two-way, such that changes in one control should be reflected in both controls. ...

WPF Datagrid binding to ObservableCollection no columns generated

Hello, I am binding a datagrid to some data and using the AutoColumnGeneration. When using a regular linq query against a dataset, everything works fine : var queryAll = from actor in actorsAll select new { ActorName = actor.IsPerson ? actor.FirstName + " " + actor.LastName : actor.CompanyName }; MalatDetailsBudgetGr...

WPF: Accessing Journal history of Frame by external button controls.

I am wondering if there is an easy way to use back and forward navigation of the frame journal but using buttons that are not part of the frame. Thank you in advance. ...

How does ObservableCollection work?

I was having a look at the ObservableCollection code (thanks to the awsome .NET Reflector) and was surprised to find that the Add and Remove methods are not overriden. How then does ObservableCollection raise the PropertyChanged or CollectionChanged event to notify when something is added or removed? ...

How to create a list of paired properties that can be two-way-bound in WPF?

Edit 2 Ok, here is the full example: public class FixedSizeLibraryViewModel : ViewModel { RawFixedLibrary _library; public FixedSizeLibraryViewModel(RawFixedLibrary thisLibrary) { _library = thisLibrary; } public string BookOneTitle { get { return _library.BookOne.Title; } set { _library...

WPF - UI binding how to ? how come this example code doesn't work

this is my xmal mainwindow : <Window x:Class="HR1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <StackPanel HorizontalAlignment="Left" Width="162"> <ListView ItemsSource="{Binding...