datatemplate

UserControl as Content for HeaderedContentControl.HeaderTemplate

Hello I have a UserControl that I have successfully been using as a header for presentations that involve a list which can be headered, using the xaml below: <DockPanel > <uc:ListSubjectHeader Subject="{Binding DisplayName}" AddNewItemCommand="{Binding AddCommand}" ImageSource="...

Order Images in ListBox DataTemplate Horizontally

Preview On the highlighted item, the images still ordered vertically even I already use <StackPanel Orientation="Horizontal">. Am I missing something? I don't want the images have ListBoxItem behavior (hover/click). I had added IsEnabled="False" to the list box, but the images' opacity decreased : ( Do you have any idea how to do thi...

ContentTemplate selection based upon the DataContext in Silverlight 4

In my Master/detail scenario, I have a datagrid as master and a UserControl as child. When a particular Row being selected in master grid I assign it to the UserControl's DataContext. In my User Control I have couple of DataTemplates as Resources and ContentControl as the Child Container. What I'm struggling with is how to dynamically se...

ElementName not working when assigning DataTemplate from code behind?

I am trying to access Control using ElementName from DataTemplate that is used in different UserControl (Resources) than defined (in xaml). Imagine this situation: MyUserControl.xaml with following DataTemplate in resources: <UserControl.Resources> <DataTemplate x:Key="SomeTemplate"> <TextBlock Text="{Binding Text, ElementNam...

DataTemplate in listview

Hi ! I use a listview to display data like a data matrix (columns and rows). My problem is : my items are typed : MatrixCellVM. I tried everything I found on the net to apply a DataTemplate on this items but nothing worked. Here is the latest technique I'm using foreach (var col in dataMatrix.Columns) { //create th...

WPF databinding to TextBox - problem updating source on LostFocus when loss of focus causes DataTemplate change

I have a ContentControl bound to a PhoneNumber object, and the control's Style.Triggers applies different ContentTemplates when the control has or doesn't have keyboard focus. <Setter Property="ContentTemplate" Value="{StaticResource DisplayPhoneNumberDataTemplate}" /> <Style.Triggers> <Trigger Property="IsKeyboardFocusW...

WPF: Adorning a ViewModel?

I have these ViewModels: RecordViewModel, ComponentViewModel where RecordViewModel essentially is a container for several ComponentViewModels. The display of these ViewModels is currently handled by DataTemplates that look something like this: <DataTemplate DataType="{x:Type vm:RecordViewModel}" > <ItemsControl ItemsSource={Binding...

is there a datatemplate for grid panel elements in WPF?

Fairly new to WPF... I have a collection of data I would like to bind to a grid panel. Each object contains its grid row and column, as well as stuff to fill in at the grid location. I really like how I can create data templates in the listbox XAML to create a UI with almost nothing in the code behind for it. Is there a way to create...

DataTemplate for ItemTemplate of a Grid displaying its content in columns

I have HeaderedItemsControl which ItemsSource is bound to a ObservableCollection<Person>. I would like to display it's content like: *Name* Müller Schmid Weber *FirstName* Peter Hans Willhelm *Age* 32 56 78 *Country* Switzerland Austria Liechtenstein My xaml-Code so far: <Heade...

How to create DataTemplate with Links

Hi, I'm trying to create DataTemplates for a PropertyCollection (of PropertyDescriptors) to display the items in the collection in this format, descriptor1 > descriptor2 > descriptor3 > descriptor4 > descriptor5 Each descriptor would be a link (using Hyperlink), my question is can I do this with Labels (which is not an ItemsControl ho...

How to write DataTemplate to display xaml

Hi, I need to display xaml code in a panel, how do I write DataTemplates to format the xaml with proper indentation and hyperlinks for references (such as StaticResource etc), for example, <ListBox ItemsSource="{Binding}" ItemTemplateSelector="{StaticResource ResourceKey=selector}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> ...

Silverlight DataGrid TemplateColumn adding problem with ComboBox

I am in little trouble with this problem. I have made a DataGrid and it have DataTemplate Columns. here is the XAML for that <data:DataGrid x:Name="PortsGrid" Height="124" Margin="23,0,17,2" VerticalAlignment="Bottom" ItemsSource="{Binding PortsGridData, Mode=TwoWay}" AutoGenerateColumns="False" SelectionMode="Single"> <data:Dat...

Binding a CollectionViewSource within a DataTemplate

'ContentTemplate' is a DataTemplate that displays an object which has a member 'FooList' (an ObservableCollection). <DataTemplate x:Key="ContentTemplate"> <ListBox ItemsSource="{Binding Path=FOO}"> ... </ListBox> </DataTemplate> I need to be able to filter that FooList using a CollectionViewSource. This is usually been...

override page PreInit inside Custom server control

Hi, I have custom server control contains templatefield when an out button clicked the field disappear , when can I rebind the control (inside its class) supposed that Control.Page.OnInit+=new EventHandler(rebind()) doesn't do any things ? ...

WPF, linking together two XML data sources in cascading ComboBoxes

I have XML in the following format: <Products> <Product name="MyProduct1"> <Components> <Component name="MyComponent1"> <Teams> <Team id="1"/> <Team id="4"/> </Teams> </Component> </Components> </Product> </Products> This is stored in an external XML file that is included via...

WPF: Dynamically change ListBox's ItemTemplate based on ListBox Items Size

I need to change the DataTemplate of my ListBox, based on the ListBox items count. I have come up with the following XAML: <Window.Resources> <DataTemplate x:Key="DefaultTemplate"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=Text}"/> <TextBlock Text="default template" /> </StackPanel> </DataTem...

Silverlight4 Element Binding Weirdness.

I'm a bit of a .net newbie and I've been working on my first big silverlight project. So pardon the lack of lingo and the length of the question. But my problem is as follows. The project is being built according to the MVVM pattern ( in this case I'm using LightMVVM ). Most of the views contain ListBoxes. These listboxes need to ha...

Bindings in two diferent Datatemplates for the same control

Hi, I'm doing a generic controller, right now is one button from telerik with two direferents datatemplates. Each dataTemplate has an specific key to id and in code-behind i change between them. My problem is i cannot do the binding to my properties. For example: My Xaml looks like: <telerik:RadButton x:Class="Itim.Framework.Silv...

WPF, getting value of TextBlock inside ComboBox DataTemplate

I have the following XAML: <ComboBox Height="23" HorizontalAlignment="Left" Grid.Row="6" Grid.Column="2" Name="cbo_team" VerticalAlignment="Top" Width="148" DataContext="{Binding ElementName=cbo_component, Path=SelectedItem}" SelectedIndex="0"> <ComboBox.ItemsSource> <Binding XPath="Teams/Team/@...

Access Element inside Silverlight DataTemplate

I have not been able to find a clean solution to the following problem even though there are a few related questions already on SO. If I have a data template that is being used multiple times, for example, a TreeViewItem.HeaderTemplate, how can I change something the template for only some of the TreeViewItems. For example, let's say m...