I'm new to WPF and the MVVM pattern so I have some problems with my bindings.
In a details view of a customer, I want to list some statuses in a combobox.
In my ViewModel the customer is at the root level, and so is the list of statuses.
When using a static resource, I can use:
ItemsSource="{Binding RelativeSource={RelativeSource Fi...
Hi
Trying to understand this binding process of the WPF.
See the code at the bottom.
In my "viewmodel", see the code at the bottom, i have an observable collection that is populating the listview with the items. Thats the one that contains a path called symbol to set the selected index in the combobox. Now my problem is that i need to...
hi there
Whats the ideal way to bind a EntitySet to a DataGrid?
I use VS2010 and the .NET 4.0 Framework.
The item in the class bound to the DataContext of my form does have the following property:
public EntitySet<MyObject> objectsToBind
{
get { return context.MyObjects; }
set { context.MyObjects= value; }
}
Any help or hints gr...
I have some existing code which uses wpf and databinding for the gui.
When using the code it works fine, it consist of several menu where you can view pictures and other stuff, and this is done by using databinding. No problem there!
But I would like to add more functionality by using Enity framework, and thereby .NET 4.0.
I have found t...
This is what I want:
There is a combo-box column bound to the ApplicationKey property of ClassA
The combo-box is populated with ApplicationTokens from a static function all.
An ApplicationToken has a ApplicationName and ApplicationKey property
When an item is selected in the drop-down, the ClassA.ApplicationKey property is set to the A...
This is what I want:
There is a combo-box column bound to the ApplicationKey property of ClassA.
ClassA.ApplicationKey is a Nullable<Int32>
The combo-box is populated with ApplicationTokens from a static function all.
An ApplicationToken has a ApplicationName and ApplicationKey property
When an item is selected in the drop-down, the Cl...
Hi,
I have a multi-binding like
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource myConverter}">
<Binding Path="myFirst.Value" />
<Binding Path="mySecond.Value" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
And I want to pass a fixed value e.g. "123" to one the the two binding above. How...
The below code works for a DataGridComboBoxColumn, but ComboBox doesn't have a SelectedValueBinding property. What should I use instead?
<ComboBox
Header="Application"
SelectedValueBinding="{Binding ApplicationKey}"
SelectedValuePath="ApplicationKey"
DisplayMemberPath="ApplicationName"
ItemsSource="{Binding So...
In this sample I have two buttons. The button in the header works, but the one in the grid gives me the error show below.
<GroupBox DockPanel.Dock="Top" >
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<Label Content="Recent Servers" />
<CheckBox Content="Auto-Refresh" />
<Button ...
Hi,
I recently databounded an xml file to a listbox. Now I want to write some function to add or delete items from that listbox. The following error came up while trying listbox.items.add or listbox.items.insert:
Access and modify elements with ItemsControl.ItemsSource instead.
I googled this and it said to work on the 'model' instead...
Hi,
I would like to bind a textbox to show the text of the item below the item that is selected.
Example:
Item 1 - Text = row numer one
Item 2 - Text = row number two
Item 3 - Text = row number three
I select item 2
output
Textbox 1 - Text = row number two (this is easily set up binding to selecteditem)
Textbox 2 - Text = row num...
Well, I needed to bind DateTime.Now to a TextBlock, I used that:
Text="{Binding Source={x:Static System:DateTime.Now},StringFormat='HH:mm:ss tt'}"
Now, how to force it to update? It get's the time when control is loaded and wouldn't update it...
...
I'm making a small personal finance program that uses "envelopes" as the budgeting method. I'm mostly doing this as a means to learn WPF & MVVM. I've run into a problem where I can't databind to the custom properties I created in my custom ObservableCollection, seen here:
public class ObservableEnvelopeCollection : ObservableCollection<...
Hi,
I'm currently binding an xml file to a listbox in C# WPF. Within the itemtemplate I added controls. as follows:
<DataTemplate x:Key="SinglecueTemplate">
<Grid Height="30" Width="425" Margin="3,3,0,3">
<Button Content="{Binding XPath=nr}" Width="30" Style="{DynamicResource CUEStyle_Button_Inhoudknopje}" T...
Hi All,
I'm trying to create a custom file upload control in WPF 4.0 and I'm stuck in one point.
I'm not able to save file in my solution folder after browsing the file. Below code I'm using for Browsing
private void btnBrowse_Click(object sender, RoutedEventArgs e)
{
// Create OpenFileDialog
Microsof...
Hi,
I have a listbox in markup and a detail control. The listbox template defines a details button for each element. If this button is pressed a dependency property in the element's datasource is set to Visiblility == Visible. As long as I do have a selected item everything is OK. But if there is no selected item, the detail control is ...
Is there a way to display the error contents in a TextBlock below the control similar to how the following sets the Tooltip to contain the error text?
<Style x:Key="textBoxInError" TargetType="Control">
<Setter Property="Validation.ErrorTemplate">
<Setter.Value>
<ControlTemplate>
...
I have the following custom Validation.ErrorTemplate:
<Setter Property="Validation.ErrorTemplate">
<Setter.Value>
<ControlTemplate>
<DockPanel LastChildFill="True">
<Label DockPanel.Dock="Bottom" Foreground="Red" Content="{Binding ErrorContent}" Margin="...
My question in short:
I want to bind to a Command in a ViewModel associated to a View.
The problem is that the place where i bind to the Command is not at the UserControl Level, but deeper.
In long, i have a GridControl (from DevExpress, but it does not matter).
<UserControl>
...
<dxg:GridControl x:Name="grdTrackChanges" DataSource="{B...
Hi
I am using MVVM light to bind events on UIElements in my View to ICommands in my view model, and this is working very well.
However - I have a situation where I have to create some controls on the fly, and I'm doing this in the code behind on the view as this seems the best place to do it, and it is after all UI code. As I am genera...