I have the following content in a Window (removed unnecessary sections):
XAML:
<Style x:Key="itemstyle" TargetType="{x:Type ContentPresenter}">
<EventSetter Event="MouseLeftButtonDown" Handler="HandleItemClick"/>
</Style>
<ItemsControl ItemsSource="{Binding ArtistList}" Margin="10" Name="artist_list" ItemContainerStyle="{Stati...
Hi, I'm new to WPF and trying a simple example of databinding, but it's not working.
My window has a TextBlock, which I bound to a property of the window object.
I declared the property in code.
When running this, I see the correct value appearing in the TextBlock.
There's also a button, which when clicked updates the property, except...
Hello,
I've recently started develping an application using WPF and I'cant really wrap my mind around following thing:
I have a Domain Model of my application which is simple POCO objects serialized to/from harddisk. Then I have the WPF application and I'd like to bind it to various parts of the model. I need to be able to notify UI o...
Hey Everyone..
I have used NHibernate in web applications before. I must admit that I am still learning NHibernate and do not totally grasp the art of session management. So I would like to use NHibernate within a Win Forms application that I am writing. I hear that session management in a Forms application is a bit different. Sessions ...
Hi all,
I have a class that has two ObservableCollection< TimeValue >'s, where TimeValue is a custom DateTime/Value pairing with change-notification (via INotifyPropertyChanged). I call these Targets and Actuals.
When I bind these to a chart, everything works perfectly, and I get two LineSeries. If I bind one of them to a DataGrid, wit...
I'm working with Databinding in ASP.Net 2.0, and I've come across an issue with the Eval command.
I have a class that I'm databinding, that looks like this:
public class Address
{
public string Street;
public string City;
public string Country;
public new string ToString()
{
return String.Format("{0}, {1}, {2}", St...
Hi,
I want to display a bunch of Objects i have created in a ListBox. My objects implement the INotifyPropertyChanged Interface.
I tried to use an ObservableCollection, which i have bound to a listbox Control (listbox1.DataContext = MyCollection)
But this does not exactly what i want to do, because the Listbox is not refreshed when one o...
Hello,
Let's say I have a simple class
public class Person
{
public string Name { get; set; }
private int _age;
public int Age
{
get { return _age; }
set
{
if(value < 0 || value > 150)
throw new ValidationException("Person age is incorrect");
_age = value;
}
}
}
Then I want to setup a bi...
I'm currently learning to develop for the .net compact framework using c# in VS2008 and have a databinding query. The list binds fine in Form1_Load, however when I add additional people to the list they don't appear in dataGrid1 (although if I remove and re-add the binding they do appear). Is there something that I need to do after I ad...
Hi,
I am a little bit puzzled as to how I can optimize my program by utlizing DataBindings. My program uses several Linq2SQL bound Objects storing the Data. All ORM objects are stored in a hierarchy. In a second GUI project I am displaying this data in some Text and Combo Box fields.
The data structure hierarchy is as follows:
JobMan...
I want to display numbers i thousand separated format. Numbers are displayed in a Column of ListView control. I've the following xaml code, but it doesn't even compile!
<GridViewColumn Header="Total" DisplayMemberBinding="{Binding PaidValue, StringFormat={0:0,0}}" />
From my c# point of view, {0:0,0} is a correct format to do thi...
Hello,
I have a set of 'dynamic data' that I need to bind to the GridControl. Up until now I have been using the standard DataTable class that's part of the System.Data namespace. This has worked fine, but I've been told I cannot use this as it's too heavy for serialization across the network between client & server.
So I thought I cou...
I know that it's a subject that can raise a lot of debate, but I'd like to know what people think the various pros and cons of using Object Datasources are. I'm doing a project right now with another programmer who's experience and comfort level are all rooted in classic ASP, and I'm unsure of which way is going to
a) get the job done qu...
Someone please help. I have an interesting issue. I am trying to implement an MVVM app and I want to bind to radiobuttons in my view.
Here's my view:
<StackPanel Orientation="Horizontal" Grid.ColumnSpan="2" >
<RadioButton GroupName="1" IsChecked="{Binding Path=NoteGeneral, Mode=TwoWay}">General</RadioButton>
<RadioButton Grou...
My scenario:
A wpf form has a textbox and a wpf toolkig datagrid.
When a text is entered in the textbox, my service returns an IEnumerable<TranslationItem> items. I want my datagrid to show the result of this service.
I tried googling around, but I can't get heads or tails to it. I'm only starting to learn WPF and most of the used ter...
The following Microsoft example code contains the following:
<Grid>
...
<Border Name="Content" ... >
...
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter TargetName="ContentRow" Property="Height"
Value="{Binding ElementName=Content,Path=DesiredHeight}" />
</T...
With DataTriggers in WPF its possible to set properties on controls based on the the object you have bound. For example you could set the Background of a TextBlock based on a IsAlive property on your object.
<DataTrigger Binding="{Binding Path=IsAlive}" Value="true">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
I ...
Hi,
I want to display some properties of a (custom) Label in its Tooltip,
but I can't seem to get it working correctly so must be doing something wrong:
<Label.ToolTip>
<Border BorderBrush="Gray" CornerRadius="5" Margin="5" Padding="5">
<Label Content="{Binding Path=Width, RelativeSource={RelativeSource Mode=FindAncestor, An...
I am filling my ElementMenu with XML and all goes fine, i only got one question. How can i put a event on the last item? It doesnt seem to react on any of it. I got this so far:
<s:ElementMenu.RenderTransform>
<TranslateTransform X="0" Y="-27.5"/>
</s:ElementMenu.RenderTransform>
<s:ElementMenu.Ite...
Hi
I have a combobox that is bound to a datasource. I want to dynamically add items to the combo box based on certain conditions. So, what I've done is add the options to a new list, and then change the datasource of the combobox like so:
cbo.DataSource = null;
cbo.DataSource = cbos;
cbo.DisplayMember = "Title";
cbo.ValueMember = "Valu...