wpf-binding

Animating "this" and "other" in WPF

Consider following DataTemplate in any List Control: <DataTemplate> <TextBlock Text="{Binding}" /> </DataTemplate> and following animations: <Window.Resources> <Storyboard x:Key="animExpand"> <DoubleAnimation Storyboard.TargetProperty="Width" To="400" Duration="0:0:1" /> <DoubleAnimation Storyboard.TargetPrope...

ChangePropertyAction to modify Visibility not working in ListBoxItem DataTemplate.

I am trying to change the visibility of a control in a ListBoxItem template (based on it beeing selected in the parent listbox) through a ChangePropertyAction but the code below does not work. I tried fiddling around with setting the TargetName on the trigger or setting the default visibility of the control through a style. I debugged th...

WPF - binding integer list to combobox

Hi, I want to bind a List to a WPF combobox in xaml. Wondering what is the simplest way to do it. (The reason behind is I want to maintain the years as integer rather than doing the type conversion from string to int. I get a list of years(2009,2010,2011) from the DB and want to be able to bind this to the combo and get the selected ...

WPF StringCollection + TextBox

ApplicationSetting: RenameSettings - System.Collections.Specialized.StringCollection - User - *wall of text" <Application x:Class="app.App" ... xmlns:properties="clr-namespace:app.Properties" StartupUri="MainWindow.xaml"> <Application.Resources> <properties:Settings x:Key="Settings" /> </Appli...

WPF: StringFormat problems with a Label

These versions work as expected: <DataGridTextColumn Header="Total Units" Binding="{Binding TotalUnits, Mode=OneWay, StringFormat=N0}"/> <TextBlock Text="{Binding TotalUnits, Mode=OneWay, StringFormat=N0}"/> When I try it with a label, the StringFormat is iqnored and I get "123.000000" instead of "123". <Label Content="{Binding Tot...

How to begin storyboard based on ListBoxItem selection???

I encounter a problem that I cannot solve. I hope to find an answer here. I need a listbox to hide half way when a certain listboxitem is selected. I setup a storyboard with opacity mask animation which work fine in blend. My problem I cannot initiate BeginStoryboard. I tried numerous ways and no success. I need to hide the listbox to r...

How to rewrite the same XAML DataBinding in Code

How do I recreate the following XAML databinding in code? I have most of it except for the DataTemplate definition. Here is an example of the DataBinding in XAML <GridViewColumn Width="140" Header="Name"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBox Text="{Binding Path=Label}" /> ...

starting with an empty DataContext on a popup

I have a popup that is bound at runtime to elements of a chart. The bindings are defined in XAML. When the application starts, I am getting many errors in the Immediate Window because the XAML bindings aren't valid (by design). I need a way to disable binding on this popup until I am about to display it during a mouseover event (in co...

ListBox is selecting many items even in SelectionMode="Single"

I have encountered something very strange, simple WPF application <Window x:Class="ListBoxSelection.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> <ListBox ItemsSou...

wpf datagrid and data binding

I want a simple sample data binding for wpf data grid. (not using dataset use list or other collections). just Xaml codes and a little code behind. Is there any simple frame work for MVVM? ...

wpf listbox dataBinding

i have a listbox who takes values from Dictionary Size: this is the Size type: public Dictionary<string, int> Size { get; private set; } this is my listbox <ListBox x:Name="boardSize" ItemsSource="{Binding Size}" ItemTemplate="{DynamicResource DataTemplate1}" /> this is my the associated DataTemplate: ...

How to set common binding properties to all controls in WPF window?

I have a data entry form with many controls. I want all controls to be bound to my data source, and all bindings to have NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged, but I want to avoid writing this in the binding of every control. Is there a way to set the common binding for all controls (most of them are TextBoxes)?...

CommandBinding question. How to enable command button

My code is here>> public class Player:INotifyPropertyChanging { string addressBar; public string Url { get { return addressBar; } set { addressBar = value; OnPropertyChanged("Url"); } } public Regex regVillage = new Regex(@"\?doc=\d+&sys=[a-zA-Z...

wpf templates styles usercontroles what are the relationships between ?

for the last week i have been trying to study WPFi took a two days course where they tryied to run all over the materiel and i just got confused can someone set my record strighet and explain me where to use each one ? what MVVM got to do with all of this ? ...

Master Detail - Binding two datasources to a window in WPF?

Hi I am trying to create a data maintenance window. A former developer created a "dataservice" application using web services. It stores a string of values that gets converted to SQL (done this way to allow for independent queries). The UI is being developed in Visual Studio 2008 using .NET 3.5. The screen I am working on at the moment...

wpf bind a controlitem to collection

hey there i am having problem i have List<List<memoryCard>> that i want to show in my xmal in a button how can I bind my button to the data i want thos is my usercontrol : < <ControlTemplate x:Key="ButtonControlTemplate1" TargetType="{x:Type Button}"> <Grid> <!--i think this is the place where i make mistake :--> ...

Cannot begin storyboard based on ListBoxItem selection???

It become really confusing since I started it. It supposed to be something simple but I already spent a good deal of time and cannot find a way around it. I need to run a storyboard on listboxitem selected with the node is 'name' and value is 'SERVERS'. The storyboard will change margins of the border with x:Name="ListBoxBorder". This bo...

WPF - DataTemplate question

Hi, I datatemplate a grid header with a button. When the button is clicked, I want to send the uid (which is a property of the grid column(parent)) as the command parameter. I Tried : 1. Template Binding 2. Relative Source 3. ElementName (doesnt accpet Binding) But nothing seems to work. Any clue, how to bind to a parent's property in...

WPF Combobox SelectedItem Problem

Hello, I am failing in achieving a very simple functionality from a WPF ComboBox. My ComboBox needs to list a collection of values. This works fine. The value id is also saved succesfully in the database. The problem is that when i want to open the window in edit mode, the combo stays empty. Here is the code : <ComboBox ...

Master Detail - Binding two datasources to a window in WPF?

Hi I am trying to create a data maintenance window. A former developer created a "dataservice" application using web services. It stores a string of values that gets converted to SQL (done this way to allow for independent queries). The UI is being developed in Visual Studio 2008 using .NET 3.5. The screen I am working on at the moment...