I am trying to make a (very) simple Data Binding test, but it doesnt work as I expected... Say I have the following classes:
// this class represents some kind of data producer
public class DataSourceClass
{
public string Data { get; set; }
public DataSourceClass()
{ }
}
//this form holds the TextBox c...
I'm binding my DataRepeater control to a table that has many columns. I'd like to only display a subset of those, depending on what is populated.
How/where should I do my contitional tests within a dataRepeater? This is the code within my itemtemplate:
<% if (0= (DataBinder.Eval(Container.DataItem, "first").ToString().Length))
{
...
I have a form showing the details of a client (various controls), along with their orders (in a DataGridView).
I am trying to add a ComboBox to let the user select one of the client's orders and display the items associated with it in a separate DataGridView.
However, I cannot work out which DataSource/DataBindings I need for either th...
I am self-hosting a WCF service in a WPF client. I want to show the data the service receives in the user interface. Every time some data is received the user interface should be updated.
The code in "App.xaml.cs" looks like
private ServiceHost _host = new ServiceHost(typeof(MyService));
private void Application_Startup(object...
I am learning wpf mvvm and have been struggling with what I feel is probably simple but have not been able to resolve on my own.
What I want is to be able to select an item in a populated combobox and then populate another combobox based on that selection. I can't seem to get the second combobox loaded in response to a selection.
I'...
I have a custom control that is basically a DataGridView docked inside a split panel with a rich text box on the other half. This control is docked in a tab page in my main program.
Here is some relevent code
public LogReader()
{
InitializeComponent();
using (var conn = new SqlConnection(ConnectionString))
using (var ada ...
I have a gridview that displays all trips - within that gridview I have a repeater that displays the countries visited during that trip (one to many). My repeater is suppose to grap the tripID and then populate the datasource, which populates the repeater. Unfortunately, my repeater is just being populated with the last tripID specified...
Hello,
I'm data-binding a ListView to a collection that comes from a service layer. In response to events, the view model associated with the ListView refreshes the ListView's data. In order to retrieve updated data, the vm retrieves a new collection instance from the service layer. Items in this collection are Equals() but not Referenc...
I have a worker thread that needs to add items to a BindingList. However, the BindingList is databound to a DataGridView. So, when I try to add to the list, I get an InvalidOperationException (Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.)
Normally for this exception you would ...
I am trying to do this as asked earlier. The only difference that I found is additional List item that was included in above code.
I tried to use AppendDataBoundItems=true but it is still not working. I also want to set the its default value to the value that was being displayed in label of itemtemplate i.e. DropDownList's SelectedValue...
Hello everybody,
i have a xaml resource file with some definitions of datatemplates. In one datatemplate i have a border background bound to a property of its dataobject.
I also have a colorpicker user control which is part of the contextmenu of the border.
Now i'm trying to bind the dependency property "CustomColor" of the colorpicke...
Greetings.
I have a DataGridGiew, bound to a object datasource - List<SomeType>. I want to sort it by string representations of fields values (ignoring real types) with grid header clicks.
I have many grids, that are bound to many lists of different object types. How can i do this as fast as possible?
Thanks in advance
p.s. framework 2...
Project Overview
Basically I was creating WPF application using MVVM pattern. However I had a thread which was updating my Data Model, so ViewModel, had to be notified about these changed and I needed a Notification mechanism in my Model. That would make my app make propagating notifications from one class to another, so I decided to Ha...
In my viewmodel, I have a list (ObservableCollection) containing items. In the view, this list is displayed in an ItemsControl. In each row, there is a "Delete" button. I want the command behind the button to remove the item from the list.
<ItemsControl ItemsSource="{Binding myList}">
<ItemsControl.ItemTemplate>
...
...
I have a ComboBox that needs to depend on the value of another ComboBox. This part already works, with the dependent ComboBox refreshing when a new value is chosen in the independent ComboBox:
<!-- Independent -->
<ComboBox Height="23" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="2"
x:Name="cbo_product" VerticalAlignm...
I am relatively new to WPF, so I apologize if I am missing something basic.
I have a user control where I declare dependency properties named PT1x, PT1y, PT2x, PT2y:
Private _pt1x as double = 9
Public Property PT1x As Double
Get
Return GetValue(PT1xProperty)
End Get
Private Set(ByVal value As ...
I have a LINQ query I wish to run and drop the result into a var or IQueryable. However, I'm binding the result to multiple (4 to 10) controls and only want the query to run once.
When I just put the result into all the datasource values, the query runs for every control and the controls (comboboxes, for example), change selectedvalue...
I'm playing around with a Canvas inside of a Viewbox, and unforunately, the only way to see the elements in the Canvas, I have to assign it a Height and Width. However, the problem is that my Height and Width values come from my ViewModel via databinding.
I know that Blend gets around this with the d: designer namespace, which is set t...
Hi
Let's say that I have a custom WPF control and couple of textboxes on it.
In code behind of my custom control I have couple of properties which are references to
objects in other control. For example I have a sth like this
public MyClass myObject
{
get
{
return MyObject
}
}
MyClass have ...
When the Flex SDK converts MXML to actionscript it generates a lot of databinding code. Sometimes, however, I don't want to bind a variable, for example if I know the variable will not change.
I can't seem to find a work around in Flex to disable the autogenerated databinding.
Also, I was hoping this might also help with some of the...