I want the ContentTemplate to vary according to the value in the DataTrigger.
And yes, I considered using a DataTemplateSelector, but now I need a DataTrigger or better said a MultiDataTrigger.
Please take a look at the following sampe app, the DataTemplate doesn't change:
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.co...
I want the Tab go forward through each item in a row, and this for each row. But actually it goes through all items in a column, column after column!
In the DataTemplate are 2 Comboboxes (let's say cb1 and cb1) and one TextBox (tb). The actual tab order is the following:
Row0.cb1,
Row1.cb1
...
Row0.cb2,
Row1.cb2
...
Row0.tb,
Row1.tb
.....
Hi guys!
I'm dynamically adding WPF ComboBox-es and I want to be able to select the added ComboBoxes with the 'TAB' key. (Dynamically generate TabIndex or something)
As it actually is:
What I want:
How would you do that?
This is the code:
<ItemsControl ItemsSource="{Binding}" Name="myItemsControl">
<ItemsControl.ItemTempla...
I've got a datatemplate for a tabcontrol's itemtemplate as follows;
<DataTemplate x:Key="TabItemTemplate">
<DockPanel Width="120">
<Button
Command="{Binding Path=DataContext.DeleteTimeTableCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
Content="X"
Cursor="Hand"...
I made myself a TransparentButton style that makes the Button portion behave the way I want it to (mouseover, enabled, etc), but what I haven't been able to do is set the content correctly in the style. Currently, I manually set everything in for every button, and clearly that stuff needs to go into the style. I have set the ContentTe...
I can't get the simplest idea of an ItemControl to work. I just want to populate my ItemsControl with a bunch of SomeItem.
This is the code-behind:
using System.Collections.ObjectModel;
using System.Windows;
namespace Hax
{
public partial class MainWindow : Window
{
public class SomeItem
{
public ...
I have a ViewModel that provides a collection of Items. There is also a ActiveItem propery. The Items collection may or may not contain ActiveItem.
What I want to do (in XAML) is display the items as a list and highlight any of the items that are equal to Active Item.
I have tried the following with no success:
<ListBox ItemsSource="{...
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...
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...
Hi
How do I programmatically find a control inside an itemtemplates datatemplate, e.g. how do I find the checkbox inside the following code:
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox x:Name="KontoFeltCheckBox"
Checked="KontoFeltCheckBox_Checked"
...
Hello.
Is there a way to fire an event from a visual within a DataTemplate in the current context (i.e. Page, Window, UserControl etc.).
For example I have a DataTemplate that contains a button or a ListBox. I want that when the button is clicked or when ListBox.SelectionChanged is fired in the ListBox, the event handler should be decl...
I have added a datatemplate to a listbox class to bind my collection to.
<ListBox x:Name="lstEmails" Height="259" Margin="12,0,12,41" Width="276" SelectionChanged="lstEmails_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Labe...
I have the following datatemplates:
First One:
<DataTemplate DataType="{x:Type WIAssistant:DestinationField}">
<ContentControl Margin="5" MinWidth="60" MinHeight="70" >
<Border BorderThickness="2" BorderBrush="Black" CornerRadius="5">
<!--This text block seems un-needed. But it allows the whole control to be dr...
Greetings,
I'm developing my application in WPF. My users are of different types: Client and SUpplier.
I would like to display some information - different for each user. I have a Property called called OperatorType which is OperatorTypeKind enum. How can i create different DataTemplates in xaml for Client and Supplier
...
I need to an extra dependancy property to a control, so I'm overriding it. I.E.:
namespace Custom_TextBlock_Sample
{
public class CustomLabel: Label
{
}
}
But I seem to be unable to add it to a DataTemplate. The following code will fail to build:
... xmlns:Custom_TextBlock_Sample="clr-namespace:Custom_TextBlock_Sample" ...
...
Hi,
I'm currently creating a control that is mainly just an ItemsControl displaying some items.
In addition I have some controls which allows the user to filter the items in that ItemsControl.
What I'm trying to do is to make it better visible to the user which items are removed when the filter is applied.
So what I did was instead of...
I am trying to use MEF on a new project within my application. Things work at the main app level, but in this separate project whose assembly is included in the main app (its a UserControl) I am wondering about something... If I have a UserControl, and in it I have the following:
<UserControl.Resources>
<DataTemplate DataType="...
I have seen solutions to a very similar issue, yet it doesn't translate to mine. (Namely, this article: http://blogs.msdn.com/wpfsdk/archive/2007/04/16/how-do-i-programmatically-interact-with-template-generated-elements-part-ii.aspx)
My ItemsControl is bound to an observable collection, which can have items dynamically added to it.
...
In my application using DataTemplate mechanism I insert into ListBox item another listbox. But is it possible that when selected one listboxitem in parent listbox, the focus may be on another parent listboxitem's child (see picture)
How to do: if one of child listbox in focus (one item from them selected), then parent listboxitem bein...
Hello,
I am switching my UserControls via DataTemplate. When I leave the UserControl/DataTemplate View I need to ask wether the user wants to save or not because else all data will be lost like graphical location points x,y of a user drag/dropped Rectangle on a canvas.
How can I hook into the datatemplate change and bring up my own sav...