I have a button control style and I want to change the padding from whatever the data-bound version is to adjust for a glyph that needs a 2 pixel offset. I'll use SimpleButton from SimpleStyles.xaml as an example (... shows where the trigger code was removed for conciseness):
<Style x:Key="SimpleButton" TargetType="{x:Type Button}" Bas...
I have a Button style and can't seem to property databind the border's CornerRadius property to the template. This is a dependency property, so it should be data bindable. I wonder if I'm missing the right XAML syntax to use?
<Style TargetType="{x:Type Button}" BasedOn="{x:Null}">
<Setter Property="FocusVisualStyle" Value=...
Hi,
Say I have an interface like this:
public interface ISomeInterface
{
...
}
I also have a couple of classes implementing this interface;
public class SomeClass : ISomeInterface
{
...
}
Now I have a WPF ListBox listing items of ISomeInterface, using a custom DataTemplate.
The databinding engine will apparently not (that I have ...
I am starting out with Silverlight. I want to display a list of messages on the UI, but the databinding isn't working for me.
I have a Message class:
public class Message
{
public string Text { get; set; }
...
}
I have the message display Silverlight User control with a Message dependency property:
public partial class M...
I've got a MenuItem whos ItemsSource is databound to a simple list of strings, its showing correctly, but I'm struggling to see how I can handle click events for them!
Here's a simple app that demonstrates it:
<Window x:Class="WPFDataBoundMenu.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://sc...
I have a DataGrid that looks like this (slightly simplified here):
<asp:DataGrid ID="grdQuotas" runat="server" AutoGenerateColumns="False">
<HeaderStyle CssClass="quotas-header" />
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
Max order level</HeaderTemplate>
<ItemTemplate>
...
I am trying to unit test my WPF databindings using the test suit provided by Microsoft Team System. I would like to be able to test the bindings without showing the window because most of my tests will be for user controls and not actually on a window. Is this possible or is there a better way to do it? The code below works if I show ...
How to enforce that developers writing XAML in Visual Studio should follow certain standards and validations need to be run and if invalid compile time errors are thrown.
For example, making sure that all the databinding expressions (some are real long) are written correctly as per 'a custom validation' I would like implement, during de...
I have run into an issue with WPF and Commands that are bound to a Button inside the DataTemplate of an ItemsControl. The scenario is quite straight forward. The ItemsControl is bound to a list of objects, and I want to be able to remove each object in the list by clicking a Button. The Button executes a Command, and the Command takes ca...
I have a DataGridViewComboBoxColumn in a DataGridView that's based on a lookup table.
The ValueMember and DisplayMember fields are bound to string columns in the DataTable. All rows have a value for both fields - except for a special record where the value field is deliberately set to NULL.
However, when I choose this record an empty s...
While trying to answer a question in the vicinity 'Unit Testing WPF Bindings' I had the following niggling question..
What's the best way to find if you have WPF Data Binding wiring setup incorrectly (or you just broke something that was wired up correctly) ?
Although the unit-testing approach seems to be like Joel's 'ripping off your a...
I am trying to perform validation in my WPF application using the solution in Detecting WPF Validation Errors.
public static bool IsValid(DependencyObject parent)
{
// Validate all the bindings on the parent
bool valid = true;
LocalValueEnumerator localValues = parent.GetLocalValueEnumerator();
while (localValues...
I am binding a List to a DataGridView. One property of the SomeObject class will be a status code (ex. Red, Yellow, Green). Can I "bind" the status to the background color of a cell easily? How about binding to a tooltip also?
...
Hi,
I'm trying to make an XML questions editor in flash.
Basically I load in the XML into a Tree component - XML like so:
<questions>
<question id="1" type="radio" text="This is question 1" isBranch="true">
<option id="1.1" correct="false" text="This is option 1" />
<option id="1.2" correct="false" text="This is option 2" />
<opti...
I have an <ItemsControl> with a custom <DataTemplate> (and also a custom <ItemsPanelTemplate> that is just a WrapPanel), bound via ItemsSource to a simple observable collection of strings.
The DataTemplate consists simply of an instance of a custom UserControl whose properties are bound to the string via {Binding}.
The problem is since...
To do DataBinding of the Document in a WPF RichtextBox, I saw 2 Solutions so far, which are to derive from the RichtextBox and add a DependencyProperty, and also the solution with a "proxy".
Neither the first or the second are satisfactory. Does somebody know another solution, or instead, a commercial RTF control which is capable of Data...
I have a binary field in my database that is hard to describe in a UI using a single "Is XXXX?"-type checkbox. I'd rather use a pair of radio buttons (e.g. "Do it the Foo way" and "Do it the Bar way"), but right now all the other fields on my form are data-bound to a business object. I'd like to data-bind the pair of radio buttons to t...
I want to set the backgroun color for a GridViewColumn that is databound inside of a listview in WPF. I'm not sure how to ask this question being fairly new to WPF, otherwise I wouldn't have bothered all of you.
I want to change the background color of the whole row, based on a bool flag in my databound object.
In this case, I have, we...
I have a (varchar) field Foo which can only be specified if (bit) Bar is not true. I would like the textbox in which Foo is displayed to be disabled when Bar is true -- essentially, FooBox.Enabled = !isBar. I'm trying to do something like
FooBox.DataBindings.Add(new Binding("Enabled", source, "!isBar"));
but of course the bang in th...
I'm writing a program that needs a configuration window for a list of connections. I have a ListBox to list the connections, and 8 or so settings for each entry. It seems I should use data bindings somehow to bind the data to something (possibly directly to the built-in settings system somehow?), how should I implement this?
...