I have a data object -- a custom class called Notification -- that exposes a IsCritical property. The idea being that if a notification will expire, it has a period of validity and the user's attention should be drawn towards it.
Imagine a scenario with this test data:
_source = new[] {
new Notification { Text = "Just thought you ...
Hello,
How can I get the Binding Path of an Element in a DataTemplate?
My XAML looks like this:
<GridViewColumn Header="Double">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding TotalValues, Mode=OneWay, StringFormat=\{0:0\'0.00\}, Converter={StaticResource...
Is there a XAML only way to automatically sort the bound items (list of ViewModel object) ItemsControl based on one of the properties of the items. The ItemsControl is part of a DataTemplate. I thought CollectionViewSource would do the trick, but how do I bind the CollectionViewSource to the ItemsControl. The follwoing code dispays nothi...
Hi,
This might be a crazy question.
Suppose a collection that has a a few entries, some of them are just empty string. Is it possible to write the ItemsControl to use different DateTempalte if the content is empty string?
Thanks a million times
...
I used Mike Swanson's illustrator to xaml converter to convert some of my images to xaml.
The convert creates a viewbox that contains the image. These viewboxes I made resource files in my program.
The code below shows what I'm trying to do: I have a viewmodel that has an enum variable called PrimaryWinding of type Windings. The values...
Hi guys!
(How long have we been using OpenIDs? I don't seem to have one connected to any provider and no FAQ on the planet seems to tell you what to do when you lose your OpenID. I've had to create a new account. Argh!)
I'm trying to fill a (carousel) listbox from a database, but I can't get the images to display. Every single example ...
How can I make a Datatemplate for a ViewModel blendable (designable in expression blend). When I go to resources and try to edit the DataTemplate directly all I see on the Drawingborad is a blank rectangle. This is because the DataTemplate is not bound to anything. Of course I can create a UserControl and create some designtime data in c...
What's a good way to get at the controls in a DataTemplate? I've used the technique of handing the Loaded event on the control of interest as well as using VisualTreeHelper to walk the visual tree and neither of those is very elegant. What's a good way to access DataTemplate controls?
In one example, I need to add a binding whos Conve...
I have a datatemplate that displays buttons in a stackpanel, whenever a user clicks at the button, the button is said to glow, so I have written the necessary datatrigger in the template and a boolean condition in the property that I'm binding too. Here are the details below
<DataTemplate x:Key="ActionItemsTemplate" DataType="ActionItem...
Is it possible to use a data template for a single item with no ListBox or other items control?
I have a datatemplate that I want to instantiate in xaml, not in a list, just within a border, and set its datacontext.
Something like (pseudo):
<Window DataContext="{StaticResource Contact}">
<!--
Here I want to show a ContactT...
I have a DependencyProperty in my custom UserControl that looks like this:
public static readonly DependencyProperty ColumnWidthProperty =
DependencyProperty.Register("ColumnWidth", typeof(int), typeof(CallBoard),
new PropertyMetadata(150));
public int ColumnWidth {
get { return (int)GetValue(ColumnWidthProperty); }
s...
I have a list box that requires at least one ComboBox. I couldn't find a way to place the ComboBox in the ItemTemplate I use.
...
<DataTemplate x:Key="parts_template">
<StackPanel Orientation="Horizontal">
<TextBlock .../>
<ComboBox .../>
</StackPanel>
</DataTemplate>
...
<ListBox x:Name="lb_parts" ItemTemplate="{StaticRes...
Is it possible to include an event handler reference in a data template that is not associated with the code-behind where the event handler is defined? I'm getting a PARSER-BAD-PROPERTY-VALUE when trying to pull this off.
For example, let's say I have this very simple XAML.
page.xaml
<DataTemplate x:Key="ItemsTemplate">
<Hyperli...
I have a listbox with a datatemplate that holds a number of controls bound to my collection.
What i want is to change the itemsource for one of these comboboxes dependant upon the value selected in one of the other comboboxes in the same row. I don't want to change the itemsource for all corresponding comboboxes within the rest of the r...
PROBLEM:
I have a custom class named BlinkingLight.
I also have a static ObservableCollection BlinkingLightCollection.
In the UI, I have a ListBox that is bound to BlinkingLightCollection.
In my ListBox I want to essentially display each BlinkingLight object as a custom control that looks like box with an LED light that has an animatio...
I'm adding my hierarchical data to a Menu-Control using the HierarchicalDataTemplate.
<HierarchicalDataTemplate DataType="{x:Type local:MyType}" ItemsSource="{Binding Path=SubItems}">
<StackPanel>
<TextBlock Text="{Binding Name}"/>
</StackPanel>
</HierarchicalDataTemplate>
My Menu is created like this
<Menu>
<Menu...
I have a DataTemplate that will be a templated ListBoxItem, this DataTemplate has a
ComboBox in it which when it has focus I want the ListBoxItem that this template
represents to become selected, this looks right to me. but sadly enough it doesn't work =(
So the real question here is within a DataTemplate is it possible to get or set th...
Consider the following collection.
True
False
False
False
True
True
False
False
I want to display it in a structured way, say, in a TreeView. I want to be able to draw borders around entire groups and such.
True Group
True
False Group
False
False
False
True Group
True
True
False Group
False
False
How do I accomplish this ...
I have a container view that looks something like this
<UserControl x:Class="Views.ContainerView">
<UserControl.Resources>
<ResourceDictionary>
<DataTemplate DataType="{x:Type viewmodels:AViewModel}">
<views:MyView />
</DataTemplate>
<DataTemplate DataType="{x:Type viewmodels:BViewModel}">
<views:MyView />
</DataT...
One of the apps I am building needs to build a survey for users to take. The relevant classes related to my question are:
Survey (string Description, List<Questions> Questions, QuestionTypes Type)
Question (string Description, List<Choice> Choices)
Choice (string Description)
enum QuestionTypes {MultipleChoicesOneAnswer, MultipleCho...