Hi.
I am in the process of implimenting the MVVC pattern and am having trouble binding a property in the viewmodel from within a DataTemplate within a datagrid. If I have a textblock outside the DataTemplate in the column it works fine (since I am directly referencing the datacontext of the UserConrol, i.e. the VM) however from within t...
Is there any way to make a DataTemplate reference itself just from XAML? In this particular case trying to reference a DataTemplate from a ListBox contained within the same DataTemplate. Here is the solution I'd like, which doesn't work.
<DataTemplate x:Key="nestedItem" DataType="{x:Type local:NestedItem}">
<Expander Header="{Bind...
I've defined a DataTemplate in a ResourceDictionary. The template need some data (for populating a ListBox). Previously the template was a UserControl and the data was provided by setting the DataContext property.
Is there some way of using code-behind for a DataTemplate or is using an ObjectDataProvider to provide the data the only opt...
Hi Everybody,
I use a datatemplate to visualize some items in a ComboBox,
the ItemsSource is bound to an ObservableCollection.
To keep it simple, let's say I put persons into the ObservableCollection:
public class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
}
My DataTemplate looks like ...
Hi
I have a an array of observable collections and I want to display all these collections in a single list box. The data in each of these collections are of the same type and they have been separated on the basis of a particular category.
So my question is, is it possible for the DataTemplate of a listbox to contain a Listbox?
...
Is there a way to examine the contents of a DataTemplate in code? I want to list out the controls in a datatemplate, looking for a specific type.
Thanks!
...
Hi
I have a ListBox that is bound to a list of Persons. I want to show the items of the listbox in a grid. I can accomplish this with the code below, but the problem is that with this code each item has its own grid. I want one grid to contain all items so that each column in the grid is automatically scaled to the width of the longest ...
I've modified my question since it has changed focus when trying things out.
I narrowed the problem down to the following...
I try to bind the selected Item of a TreeView to a StackPanel (or some other container that can hold User Controls). This container will then display a UserControl, depending on the type of the selected item.
Her...
I have a ComboBox with a DataTemplate. The DataTemplate has two controls, each of which has a ToolTip attached to it. The list of items of the ComboBox has the tooltips as expected when you hover over each control. But the selected item area on top of the ComboBox does not display the tooltips, though the controls are rendered as expecte...
Hi,
I want to load my WPF UserControl with dynamic rows. My scenario is as follows.
1. When the UserControl gets loaded, I will populate my List<string> object with some values which I will get from a database.
2. I need to create equal number of rows in my UserControl which matches the number of items in the List<string> object. The d...
Hi,
I'm trying to setup a ListBox so that every item has a textblock and a combobox, split evenly across the width of the listbox but I can't seem to find the magic combination of ColumnDefinition properties to do it. Here's my DataTemplate for the listbox item. I've cleaned it up since it was wrong, anyhow.
<DataTemplate x:Key...
I'm adding TreeViewItems manually in code behind and would like to use a DataTemplate to display them but can't figure out how to. I'm hoping to do something like this but the items are displayed as empty headers. What am I doing wrong?
XAML
<Window x:Class="TreeTest.WindowTree"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/p...
Hi,
I have an object with two arrays of strings. The object is data bound to a listbox. One list is bound as the list's ItemsSource. The other, which is the thing causing me trouble, needs to be bound to a combobox that's part of a DataTemplate that is set to the list's ItemTemplate. Basically each item on the listbox has the correspond...
I'm trying to bind some data to a WPF listview. One of the properties of my data type is of type byte[] and I'd like it to be shown as a comma-delimited string, so for example { 12, 54 } would be shown as 12, 54 rather than as Byte[] Array. I think I want to make a custom DataTemplate but I'm not sure. Is that the best way? If so, ho...
I would think this is possible, but the obvious way isn't working.
Currently, I'm doing this:
<ContentControl
Content="{Binding HurfView.EditedPart}">
<ContentControl.Resources>
<Style
TargetType="ContentControl"
x:Key="emptytemplate">
<Style.Triggers>
<DataTrigger
...
I am working an a sortable WPF ListView and I made a lot of progress already. It's not so hard since there is a lot of stuff on the internet already. But there is a little bit of information I am still missing.
With a Colum like that:
<GridViewColumn Width="200" Header="Fahrzeugname" DisplayMemberBinding="{Binding Name}">
I can sort ...
Given xml that looks like this:
<Root>
<Fruittree name="Apple" ID="2">
<Branch name="West" ID="1">
<Fruit name="Foo">
<Fruit name="Bar">
</Branch>
</Fruittree>
<!-- more fruitrees etc... -->
</Root>
Using xaml with a XmlDataProvider and a DataTemplate, I want to display a list, perhaps in a listbox:
...
Hi,
I'm using this workaround to get a CommandProperty for mouse actions such as a left double click: http://www.wpfmentor.com/2009/01/how-to-add-binding-to-commandparameter.html
It works fine...
I'd like to use that workaround with a DataTemplate but {Binding Path=ID} doesn't seem to work for the DataResource.BindingTarget as it do...
Hi all, I got a problem trying to find an element declared in DataTemplate, that after was applied like a ContentTemplate to TabItem object.
I saw that there is already some solutions in regard of this problem, but no one of them actually works in my case, and I would like to understand why (obviously I make mistake in some place)
Here ...
I have a custom UserControl which has a DependencyProperty "ItemTemplate" of type "DataTemplate". I create an instance of this ItemTemplate via .LoadContent(), assign the .DataContext and put it an ContentControl. The only drawback I have is that DataTemplate.Triggers are not fired.
Example Xaml Code:
<Window.Resources>
<DataTempla...