I am writing an application that uses a GridView. I am dynamically creating GridViewColumns and setting their CellTemplate.VisualTree property to a FrameworkElementFactory that creates a StackPanel containing some other elements. The DataContext of the StackPanel is being bound to an item contained in a collection in the dataitem. Basica...
In my database I have a 2 columns (Kind and Priority) that are of type int. I also have an enum with the values of Kind and Priority. But when I try to display them into a GridViewColumn, it shows the integers and not the enum values. Do I need a converter Here is the enums:
public enum Kind
{
None = 0,
Task = 1,
Assignment ...
I have a form (WinForms) with a TextBox Binded to a Datasource.
The datasource is a LinQ To SQL query returning one single row.
This row have only one filed, varchar(100), not nullable.
My problem is that if the user go to the field (with the focus), he can't exit while he insert a data because the data field cannot accept null.
It is...
Is is possible to make the contents(children) of a WrapPanel to be bound to a dependency property?
What I am thinking is having a dependency property that is of type List and then define a template for MyClass.
Then have the WrapPanel display them.
I know this is much easier done with a list box, but due to other constraints, I need t...
I have the following xaml:
<ItemsControl>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Name}"></Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
In my code I have an event that gives me access to the button. How can I take the button object and get the ob...
This question is very similar to Change WPF DataTemplate..., which I have read and implemented. It worked beautifully at first, but I ran into a problem with it.
That problem is that, when using themes in your application such as those in the WPF Futures project (e.g. Expression Dark), the ListBoxItems all revert back to the default WPF...
[.NET 2]
Situation:
class MyObject
{
string Max { get{...}; set{...}; }
string Min { get{...}; set{...}; }
}
MyObject myObj1 = new MyObject();
// ... code
txtMin.DataBindings.Add("Text", myObj1, "Min");
txtMax.DataBindings.Add("Text", myObj1, "Max");
Problem:
Need verifying Min < Max bef...
I have a class (MockWI) that I have defined the following DataTemplate in app.xml
<DataTemplate DataType="{x:Type local:MockWI}">
<Button Content="{Binding Name}"/>
</DataTemplate>
In my code I need to find the UI object that an instance of MockWI has.
Right now I do this:
Button elt = new Button { Content = myMockWI};
But tha...
I have a sub control embedded inside my main control, it allows the user to edit an address. Because this is reused all over the place (sometimes in multiple places on one control) I bind it like so
<Controls:EditAddressUserControl DataContext="{Binding Path=HomeAddress}"/>
<Controls:EditAddressUserControl DataContext="{Binding Path=Wo...
How do you avoid duplicate bound items in this scenario:
There's a databound control on a page (a DropDownList in this case, though I don't think it matters). It has AppendDataBoundItems set to "true". Somewhere in the code, a DataSource is set and DataBind is called. So this control is bound explicitly.
You have a bunch of other th...
This is very similar to this question I asked earlier. I am hoping to be clearer and get a different answser.
I have a Data Object (called MockUI). It has a data template (in app.xaml) like this:
<DataTemplate DataType="{x:Type local:MockWI}">
<Button Content="{Binding Name}"/>
</DataTemplate>
In my code I want create a UI obje...
I often use textboxes in my wpf-projects which are bound to datetime-propertys. I want to format the dates into the german format dd.MM.yyyy.
Currently I do this with a self-written converter, which I can give the needed dateformat.
For example like this:
<TextBox Name="Date" Text="{Binding RelativeSource={RelativeSource Mode=FindAnces...
I created programatically a class (I called it ViewGrid) so that I use an instance of it as ItemTemplate for my ListBox control; of course, it's my data template for the listboxitem....
Also, in my ViewGrid class, I got a dependency property called IsChecked and I want to keep it in sync with the ListBoxItem's IsSelected property. I not...
So.. I have a problem. I'm sure almost anybody that tried MVC has had it. Nevertheless I've been unsuccessfull in googling a solution or thinking of one for my self.
The problem is this: I have a list of textboxes that I'd like to edit all at once, and I'd also like to add new items to my list. However, the text binding fails after the ...
I have a class for my data, MyData, and I'm accessing it in my gui by data binding. I decided to set the DataContext of the main panel in my window to an instance of this object so I could bind my various controls to it's members. So I could easily reference it in my xaml, I created an instance of MyData in Window.Resources like so:
<lo...
I have a ListView that includes an EditItemTemplate and an InsertItemTemplate. The two forms share almost all of their markup. For example:
<asp:listview runat="server" ... >
<layouttemplate>...</layouttemplate>
<itemtemplate>
<p><%#Eval("Name")%></p>
<p><%#Eval("Title")%></p>
...
</itemtemplate>
<insertit...
Hi,
This is probably a simple question, but I can't seem to find an answer.
One of my web pages has an ASP.NET FormView and two SqlDataSource controls. I need to show data from both datasource controls in the FormView. Most of the data will come from datasource1, with 2 or 3 items coming from datasource 2. The way I am trying to do ...
Hi, I'm trying to create a button that behaves similarly to the "slide" button on the iPhone. I have an animation that adjusts the position and width of the button, but I want these values to be based on the text used in the control. Currently, they're hardcoded.
Here's my working XAML, so far:
<CheckBox x:Class="Smt.Controls.Slide...
I've been working on a C# project which uses a TabControl. I have a DataTable which is bound, using the same DataView to two different entities, a ListBox in one tab, and a DataGridView in another.
I've started saving the user's selection for those controls between launches. At launch, both the ListBox and the DataGridView are set to ...
I've got a problem with my little app here that is conceptually very simple. I have an XML file that essentially just maps strings to strings.
Long-winded explanation warning
A sample file would look something like this:
<Candies>
<Sees>Box1</Sees>
<Hersheys>Box2</Hersheys>
<Godiva>Box3</Godiva>
</Candies>
Although I coul...