My code behind file receives an instance object Session which has a property AvailableCountries that returns a List. Each Country object has a Name property which is a String.
I also want to display these Country objects using a data template which I simplified here.
My current code is after going through a WPF binding tutorial, only t...
I need to dynamically set the contents within the template of a DataGrid based on information in an external settings file. That settings file specifies which data fields should display in the DataGrid. The administrator of the application can edit the settings to change the fields to display. I cannot hard-code the fields to display.
I...
I have a ViewModel (AbstractContextMenu) that represents my context menu (IContextMenu), and I bind a real ContextMenu to it with a DataTemplate:
<DataTemplate DataType="{x:Type local:AbstractContextMenu}">
<ContextMenu x:Name="contextMenu"
ItemsSource="{Binding Path=(local:IContextMenu.Items)}"
IsEnabled="{Bind...
I'm trying to follow the MVVM pattern laid out here: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090097 I have this in my MainWindowResources.xaml file:
<DataTemplate DataType="{x:Type vm:VendorsViewModel}">
<vw:Vendors/> <--- I get a "Can't put a page in a style" error in blend with this
</DataTemplate>
and I'...
I have a combo box that is based on a data template the includes check boxes like such:
<ComboBox x:Name="cboComplex" Text="Select days...">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding Path=IsSelected}" Width="20"/>...
I have this code:
<Grid x:Name="LayoutRoot">
<Grid HorizontalAlignment="Left" Height="900" Width="1200">
<Grid.RowDefinitions>
<RowDefinition Height="300"></RowDefinition>
<RowDefinition Height="200"></RowDefinition>
<RowDefinition Height="200"></RowDefinition>
</Grid.RowDefinition...
While designing a new WPF application I noticed exceptions not being thrown during data binding for controls with DataTemplates. To test I wrote the following simple user control with as little logic as possible. I'm using .NET 3.5 SP1, VS2008 SP1 running on WIN7.
When the DataContext is set, TestMethod is called and an exception is t...
<local:CustomDataGrid Grid.Row="0" Height="200"
IsReadOnly="True" x:Name="dgCaseHistory"
AutoGenerateColumns="False">
<local:CustomDataGrid.RowDetailsTemplate>
<DataTemplate>
<Grid Background="Black" Height="{Binding ElementName=dgCaseHistory, Mode...
I'm trying to create a series of bound columns in a RadGridView, and I'm using a template to create hyperlinks in two of the columns. Here is basically what I have:
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Distributor" DataContext="{Binding Distributor}" CellTemplate="{StaticResource linkTemplate}"/>
and,
<DataTe...
I'm porting a WPF application to Silverlight.
DataTemplates in XAML are used to define the visuals for the data objects.
In WPF, triggers are defined in the DataTemplates to provide mouse-over effects, etc. This is all done in xaml.
I understand that Silverlight does not have triggers, and you are supposed to use the Visual State Manag...
<ListBox.ItemTemplate>
<DataTemplate>
<Grid x:Name="grid">
<Grid.Background>
<SolidColorBrush x:Name="backgroundBrush" Color="Transparent" Opacity="0.1"/>
</Grid.Background>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsExpanded}" Value="Tr...
I need to access element named "PageHost" for the selected list item in the following XAML code from C# codebehind, how to do so please ?
<ListView.Resources>
<p:PageWidthConverter x:Key="PageWidthConverter" />
</ListView.Resources>
<ListView.ItemTemplate>
<DataTemplate x:Name="PagesVi...
Hi,
I have a ListBox bound to an ObservableCollection with an ItemTemplate that contains another ListBox. First of all, I tried to get the last selected item of all the listboxes (either the parent and the inner ones) from my MainWindowViewModel this way:
public object SelectedItem
{
get { return this.selectedItem; }
set
{...
Hi,
I am using Silverlight 3 to develop an application. In my app, I have a layout Grid (named "LayoutGrid") in which I have a DataGrid (named "PART_datagrid") with DataGridTemplateColumns. The LayoutGrid is set a DataContext in which there is a Ladders list as a property. This Ladders list is set as the ItemsSource for the PART_datagri...
Hello,
what is the difference, both works: DataGridTemplateColumn versus DataGridTextColumn
both works means I can edit+display rich text in the cell.
<DataGridTemplateColumn Header="Homework">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<RichTextBox >
...
Hi,
I have tabcontrol,in that by pressing second tab button im adding data to third Tab Listbox.But its not get added.
SecondTab function:
private void Callbutton_Click(object sender, RoutedEventArgs e)
{
tab.AddPresetmenu("CALL BUTTON");
}
ThirdTab Fucntion:
ObservableCollection<DataItem> items =...
Hi,
I have a combobox whose ItemTemplate is a Checkbox. This is checkbox is bound to an object which has a bool and a string. The checkbox checked state is bound to the bool and the content is bound to the string.
I want a select all option at the top of the combobox collection, which has an indeterminate state, according to the other ...
[Original]
I have a listbox which has its itemssource (this is done in the code behind on as the window is created) databound to an observable collection. The List box then has the following data template assigned against the items:
usercontrol.xaml
...
<ListBox
x:Name="communicatorListPhoneControls"
ItemContainerStyle="{Sta...
Ok, this is an embarassingly simple-looking problem, but is driving me crazy. I'm learning about DataTemplating and am trying to apply a very VERY simple ItemTemplate to a ListBox.
However, when I run my app, the template is completely ignored and I just get the standard-looking listbox, whereas in fact I'd expect to see a list of check...
Hi,
I am trying to learn something about WPF and I am quite amazed by its flexibility.
However, I have hit a problem with Styles and DataTemplates, which is little bit confusing.
I have defined below test page to play around a bit with styles etc and found that the Styles defined in <Page.Resources> for Border and TextBlock are not app...