A quick question on binding to a command in WPF. I've got a command that expects a Boolean as the parameter to execute, but I don't know how to specify the type in the xaml, anyone give me any pointers?
Command Code
public override void Execute(object parameter)
{
Boolean saveAs = (Boolean)parameter;
}
Xaml Code
<MenuItem Header=...
Hello!
I have a DataGridCell that contains a ComboBox.
I want, that when I fire 'SelectionChanged' event of it, a CollectionViewSource of a different column (eventually - at runtime, cell) CellEditingTemplate's Resources should be populated with data according to the selected value for this row.
Maybe DataTrigger, ActionTrigger, Event...
How can I DataBind my Image control to automatically get the player.PlayerImage updates? As you can see from my code, I have tried to setup databinding, however it's not working.
Below is my current setup:
I have a CLR class called CDGPlayer that implements INotifyPropertyChanged.
The CDGPlayer class has a property called PlayerImage
...
Hi,
I wrote a very simple WPF application which has a listview and 2 buttons. The listview is initiated with 3 items. The button 'Add' when clicked will add new item to the list. The button 'Change' when clicked will change the selected item content. The bug raises when we click this 2nd button.
I upload the solution codes here. In the...
Hi,
I have a requirement to generate a "report" in WPF which is simply a grid.
However, the columns and the styling rules (e.g. "Red if value below zero") for this grid are unknown at compile time.
There are hundreds of questions like this and I must have read over half of them but I cannot find a solution to this requirement which wo...
Hello,
I am constructing my app infra structure, and finding it hard to achieve a very basic behavior - I want to raise events from different user controls in the system and being able to catch those events on some other user controls that listens to them. For example i have a user control that implements a TreeView. I have another user ...
I have the following class Person:
public class Person
{
public string Name
{
get { return name; }
set { name = value; }
}
public string Nickname
{
get { return nickname; }
set { nickname = value; }
}
private string nickname;
private string name;
p...
I have a data template for a type that defines a bunch of data entry fields, all with similar settings on the textboxes, something like this:
<DataTemplate x:Key="ContactInfo">
<DockPanel>
<HeaderedContentControl Header="Contact Name">
<TextBox Width="200" Text="{Binding Name, ValidatesOnDataErrors=True}"/>
</HeaderedCon...
I have a Listbox with items created through databinding. The item template creates a custom view for each generated item. Each generated item view is its own user control.
I'd like to change the state of the listbox to something like "Details" vs. "Compact" and have each item have its own state changed automatically. The view item kn...
There may not be any practical use of what I want to do, but just to satisfy my curiosity can we compact the 2nd binding in the following XAML into 1 line
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource MyConverter}">
<Binding Source="{StaticResource One}"></Binding>
<Binding>
...
B"H
I was wondering if there is any simple way to represent an EntityCollection (from a navigation property) in a WPF DataGrid.
Specifically the issue is with deleting items.
Displaying, Updating and even Adding items works fine. However the EntityCollection's Remove function only deletes the relationship, not the object. So when the ...
I want to achieve a simple Subscribe/Publish mechanism within a WPF application so i can subscribe to events from different places in the application specifying the event type and handler method, and then when publishing the event, my mechanism will call all the subscribed methods on the subscribers. I cannot use the RoutedEvent as I wan...
I'm trying to understand binding to local items using XAML. I'll make this a two part question, but both deal with the same basic situation:
Say I have a custom user control called MySelector
MySelector includes a ListBox called listBox1
MySelector includes a List<string> property called TextList
TextList is a read-only property t...
I am trying to map a TreeView to a collection using the HierarchicalDataTemplate. The collection contains an Object that contains child entities of itself(Many To Many Relation), and then goes down to another object using regular one to many relation.
I use the followings:
<HierarchicalDataTemplate DataType="{x:Type src:Organization}" I...
I have a WPF ListView control containing a number of RadioButton controls using data binding. I'd like the first RadioButton in the group to be checked by default, preferably set in the XAML rather than programmatically, but haven't managed to achieve this.
My XAML for the control is:
<ListView ItemsSource="{Binding OptionsSor...
I am working with a 2 lists in a backend class. Each list is a different type. Would like to present the user with a single list (containing a union of both lists) of which when an item in this list is selected the item's details appear.
The code will look something like:
My backend class looks somethings like this
public ObservableC...
I want to use CommandParameter attribute in a context menu associated to a DataTemplate. The commandParameter should contain a reference to the object that triggered the data template as shown in the code sample below. I tried to use "{Binding Path=this}" but it does not work because "this" is not a property. The command fires but I can'...
Hi Folks,
I have a small project that I think WPF would be perfect for, I don't however have that much time so I am looking for feasibility information and pointers. I am trying to display a large number of items from an XML document and from what I have read so far I believe it would be possible to:
Use the XML document as a dataSour...
Hi everyone.
Ok, this has been driving me nuts for the last two days!
I'm new to C# aand have been teaching myself via writing a simple app.
I have a simple form that comprises of a combobox and two text boxes. The combobox contains a list of the entities in the database table. The text boxes allow the user to add new entries. It is ...
I have a WPF ListView with a collection of RadioButtons. I want to set the GroupName of the child controls to be bound to a property on the parent data context. At the moment I am doing this by duplicating the property in each of the children's data context but that can't be right.
My XAML:
<ListView ItemsSource="{Binding OptionItem...