binding

What should Binding Path property be set to?

Hi All, Assuming I have this struct definition in C#: public struct TimeSlotInfo { public int TimeSlotID; public int StartMin; public int CalcGridColumn; public string BackgroundCol; public bool ToDisable; } And I have a linq query as so: var TimeSlotsInfo = from ts in datacon.TimeSlots select new TimeSlotInfo { Ti...

Problem binding to static property

I'm having a hard time binding a simple static string property to a text box. Here's the class with the static property: public class VersionManager { private static string filterString; public static string FilterString { get { return filterString; } set { filterString = value; } } } In my xaml, I j...

C#/winforms: how to best bind a propertygrid and a System.Data.DataRow

hello, i have System.Data.DataRows with several fields, most of them just plain types like int, single, string. what is the best way to make them editable using a propertygrid? it should work automatically no matter what kind of fields the datarow has, but it should not display all of them. i want to provide a list of properties that s...

C# WPF IsEnabled using multiple bindings?

I have a WPF xaml file describing a section of a GUI and I'd like the enabling/disabling of a particular control to be dependent on two others. The code looks something like this at the moment: <ComboBox Name="MyComboBox" IsEnabled="{Binding ElementName=SomeCheckBox, Path=IsChecked}"/> But I'd like it to be dependant on anot...

WPF : An alternative way to specify a ValueConverter on binding

Most common way I encountered of specifying a value converter for a binding is to: 1. Create an instance of the value converter as a resource with a key. 2. Reference the instance using StaticResource markup extension: <TextBlock Text="{Binding Converter={StaticResource myFormatter}" /> Q: Is there anything wrong with using static ins...

Creating a WPF ValueConverter for a Brush

On the Nerd Plus Art blog today, there was a post about creating WPF Resources for arrows, which the author uses frequently. I have a side project that has Back and Forward buttons, so I thought that the Left and Right arrows would work great on those buttons. I added the LeftArrow and RightArrow Geometries to my application's resources...

Not able to bind click event to newly created span items (jQuery)

Hi guys. I'm not able to bind events to a list that is generated by jQuery. I've looked at some similar issues, but havent found any solution. This is the code that generates my list: var list = '<ul>'; for (var i = 0; i < data.length; i++) { list += '<li id="' + data[i].id + '"><span class="btnRemoveItem" title="Remove item from...

WPF Force rebind

I have an object that can't inherit DependencyObject OR use NotifyPropertyChanged, and I've binded it to quite a few controls, so when the properties change, I don't want to go to each control and change it's value on the code, so I'm thinking there must be a way to tell the XAML to "Rebind" all that it's bound to with one or two lines o...

Binding a wpf listview to a Dataset....Possible..?

Hi, I was struggling moving to Wpf,I am just stuck while trying out databinding to a lsitview.I want to databind a listview to a dataset(dataset because the data i want to display in columns belongs to different tables).I am attaching a sample code that i am trying with.It works alright but the listliew only shows one row.What could be w...

How do I bind a dictionary to a set of checkboxes using ASP.NET MVC?

My need is to 'bind' Dictionary<MyType, bool> to list of checkboxes in asp.net mvc. I'm confused about how to accomplish that. Could anyone help me? ...

WPF - IsEnabled Binding to DependencyProperty not working properly

I have a dependency property defined in my window as below: public static readonly DependencyProperty IsGenericUserProperty = DependencyProperty.Register("IsGenericUser", typeof (bool), typeof (MainWindow)); public bool IsGenericUser { get { return (bool) GetValue(IsGenericUserProperty); } set { SetValue(IsGenericUserProperty, v...

WPF Binding: Where a property contains the path to the value

Hi, I've got an expander with a couple of TextBlocks in the top bar which i'm using to give a title and a piece of key information. Ideally i want to set the path to key piece of information, but i can't work out how to bind the path of the binding to another path (i apologise if i'm not making much sense!) In the following xaml the f...

Model object is null in MVC's aspx page

Scenario: I have a page which contains a dropdownlist and a table which contains a list of details based on the value selected in the dropdownlist when the dropdown is changed. Now at first instance when the page is loaded, the dropdownlist contains a blank value followed by other values. So for the first time there won't be any values ...

WPF: How to bind to a nested property?

I can bind to a property, but not a property within another property. Why not? e.g. <Window DataContext="{Binding RelativeSource={RelativeSource Self}}"...> ... <!--Doesn't work--> <TextBox Text="{Binding Path=ParentProperty.ChildProperty,Mode=TwoWay}" Width="30"/> (Note: I'm not trying to do master-details or an...

JiBX: How do I keep using interfaces in my code?

How can I keep my using interfaces in classes I want to use JiBX binding with? Example: I have this very simple model in java: public interface A { B getB(); void setB(B b); } public interface B { String getData(); void setData(String data); } public class AImpl implements A { B b; @Override public B getB...

Entity Binding in Winforms - one to many

I'm struggling with the Entity Framework when creating a new record in a one to many relation. I've the following tables defined: Person PersonInternetAddresses InternetAddresses The Entity Framework has created the EntityObjects Person with a navigation property named PersonInternetAddresses and InternetAddresses with a navi...

ASP.Net search button example to load GridView?

Using ASP.Net 2.0 I need an example of how to load a GridView after clicking a button on the page. I am unable to get the events right - with the PostBack in the PageLoad, seems it's not getting it right. I have three textboxes whose contents are passed to a query which is executed and a datatable is returned. But how and in which ord...

Setting the ItemsSource of a combobox from an INDEXER in XAML???

I have a cache that retrieves collections based on a string (collection name) passed to the cache (ie... GlobalCache.Instance["States"]) I added a resource as following: < EnumCache:GlobalCache x:Key="GlobalCache" /> then the control.... <dataControls:DataFormComboBoxField x:Name="cmbStates" ItemsSource="GlobalCache.Instance['...

Data binding support in O/RM tools, how to detect

I want to verify that a generated class (single entity or collection) from an O/RM tool is data binding compatible. I read that supported data binding types in WCF are: one time, one way, two way, one way from source in WCF. But how about "old school" .NET 1.1 data binding ? It looks kind of difficult to check in code what kind of dat...

Alternative to INotifyCollectionChanged

I'm starting to dip my toe into WPF, and I would like to have the collections in my application work with as an ItemSource. I tried implementing INotifyCollectionChanged. I'm ok with that except that then I have to reference WindowsBase.dll in about 15 dll's. Is there another interface that WPF can use for binding that I might already...