I have a ListBox showing data about employees such as name, department photo, badge number, etc. Employees may have different types such as Manager, Staff, Volunteers. I have 3 separate data templates - one for each type. All of these templates show basically the same data but presented differently.
Depending on the user logged into the...
I have a class with a boolean static property called CanSeePhotos and this should control the visibility of pictures in my DataTemplate.
For debugging purposes I am binding "CanSeePhotos" to a text block in the DataTemplate.
What I would like to do is:
InitializeComponent()
Set CanSeePhotos based on the logged-in user
Load data and s...
Hi,
I'm using a datatemplate for a type that has got a property which is the file address.I need to create a textbox with a button which will open an openFileDialog and then insert the selected file address into the textbox I wanna know what's the best way for creating the textbox and the button next to it which will show the openfiledia...
The following xaml works ok inside a Window:
<Border Width="45" Height="55" CornerRadius="10" >
<Border.Background>
<ImageBrush>
<ImageBrush.ImageSource>
<CroppedBitmap Source="profile.jpg" SourceRect="0 0 45 55"/>
</ImageBrush.ImageSource>
</ImageBrush>
</Border.Background>
</Border>
But when ...
Ok I got the following DataTemplate:
Style="{StaticResource LBStyle}" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
...
I'm trying to display a class using a treeview but nothing is displayed. I've inspected the container with Snoop and I see the StackPanel, but it's empty, even the the project does have a title and pages. There are no binding errors and I have no idea why it's not working.
public class Project : INotifyPropertyChanged {
public s...
Hi,
I want to create a datatemplate (in code, but thats not the point) which allows me to click on an item and set its bool value. What I managed to create was a combination of CheckBox and TextBlock, which is colored depending on the bool value.
So far so good... But how can I tell WPF: If anybody clicks on the TextBlock, change the b...
Hi !
Suppose you have WPF Window composed of many elements that are using DataTemplates / ControlTemplates (ItemControls ... )
But you want to see how every DataTemplate looks like in VS Designer.
What more, if you define a ControlTemplate from as a Template located in another file to be able to view it with the content.
Something lik...
Morning folks,
I'm still trying to get my head around databinding in WPF and so I'm having a bit of a problem working out how to solve this issue: I have a datatemplate for a button that I use to display information from a class I have set up, and I've been using a ListView Itemsource to pass in the list of these class objects which is ...
I'm having a very annoying problem with my datatemplates, the mouseOver template won't show any of the databound controls, so only the label and textbox are shown on mouseover. Theres no errors so I think I'm just missing something. The code - first one is used as a the Content Template when on MouseOver:
<!-- Data Template used whe...
ok currently i have this piece of code:
<TabItem Style="{DynamicResource MyStyle" x:Name="TabCustomers" Padding="0,1,4,1"
Header={Binding Path=customersHeader}/>
Now i want to add an icon there so I do (by removing the header above):
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Stretch="UniformToFill" Source="{...
Is there any way to bind a value to a textblock that is obtained from a method. For example, I pass my Person object into the HierarchicalDataTemplate, from there I can access its Weight property. Now lets say I want to get the weight in mars, I would call the InMars method that takes a parameter of int EarthWeight . Now earthweight is g...
If I have a custom class called "VideoMedia" (which contains a standard Uri for the video path) and I have a DatatTemplate that I use to create a Video Player like control.
<DataTemplate DataType="{x:Type v:VideoMedia}">
<MyLib:VideoPlayer/>
</DataTemplate>
(The VideoPlayer class extends UserControl and simply controls the playbac...
I defined in XAML DataTemplate for my own type.
<DataTemplate DataType="{x:Type MyType}">
...
</DataTemplate>
Now I want to add one more template for the same type in the same scope. How would I choose then which of templates to use in concrete ItemsControl?
Background:
I have ItemsControl that displays objects of different types...
I have WPF ComboBox inside a data template (a lot of comboboxes in listbox) and I want to handle enter button. It would be easy if it was e.g. a button - I would use Command + Relative binding path etc. Unfortunately, I have no idea how handle key press with a Command or how to set event handler from template.
Any suggestions?
...
Hi,
Recently I'm trying to reuse some UI elements in my application. When I started programming with WPF I'm told that DataTemplate is the best way to reuse UI elements. You can define a template for your data entity and use it everywhere. It sounds very good.
However, I also found some disadvantages, especially when it is compared wit...
I have ItemsControl in a WPF application, which is bind to an array of objects.
And I am using ItemTemplate to render the list.
I want to display for each item in the list the item order, like for example
Customer 1
Name : xxxxx
Age: 9999
Customer 2
Name : yyyy
Age: 8888
Any idea how to do it
Thanks
...
So I'm going through a style (in this case, WhistlerBlue.xaml) and I'd like to be able to use TemplateSelectors with my data.
However, this seems a fallacy because it just doesnt seem to work! How can I (Aside from carte-blanch commenting out the offending style, the ListBoxItem style) use a DataTemplateSelector with it?
...
Does anyone know if and how one can disable one or more listbox items in a wpf lisbox without disabling the entire listbox?
Preferably I would have a DataTrigger which, when a certain Binding value is false, disables this item (make it impossible to select) while keeping other items in the same listbox active.
<ListBox>
<ListBox.Item...
I have some reusable ContentControl, which acts as a pseudo-modal popup inside another view.
It is always there and only its visibility makes it appear or disappear.
When instantiated, within the ContentControl there will be a custom ContentTemplate, bound to some ViewModel and representing the content of the "modal popup".
<Dialogs:Mod...