-
Mediator
c# wpf xaml listbox datatemplate
I have ListBox and DataTemplateI need Set GroupBox Heigth = 300How to do it?<DataTemplate x:Key=”data_template”><GroupBox Header=”?????????” Width=”300″ HorizontalAlignment=”Stretch” x:Name=”GroupBox”><DockPanel Tag=”{Binding id}”><Button Click=”Button_Click” DockPanel.Dock=”Top” ><Button.Content><DockPanel><TextBlock Text=”{Binding title}” TextWrapping=”Wrap” DockPanel.Dock=”Top” Padding=”5″ HorizontalAlignment=”Center” Foreground=”#FFB51414″ /><l
-
Joachim Kerschbaumer
c# wpf datatemplate
the FrameworkElement’s FindResource method allows to get resources defined in this frameworkelement. however, i have some dynamic resources located in another assembly loaded at runtime. Accessing it with DynamicResource from within XAML is no problem, but i wonder how i can get access to Dynamicresources from code (e.g. datatemplateselectors). thanks
-
Rob Fonseca-Ensor
mvvm datatemplate datacontext blend
I’m currently using MVVM in a WPF project, all works very well. I have one Master view and many Detail views that I manage using a currentView property in my MasterViewModel. By using a datatemplate, I bind a view to a viewmodel. In fact, my master view has a contentcontrol whose content property is binded to my CurrentView property. When I set this currentview property to a viewmodel or another, it calls the corresponding template.My problem is that using this, my detail views doesn’t have expl
-
user544511
c# wpf user-controls datatemplate
QuestionBasically I would like to do the following but it seems that I cannot:UserControl myControl = new UserControl(); DataTemplate template = new DataTemplate(myControl);The question: Is it possible to construct a DataTemplate from UserControl instance? If not, are there any other possible solutions? Real problemI’m working on a project where majority of UI views are simple static Word-like documents (e.g some text fields and maybe some images, nothing too fancy). Because most of persons w
-
DeeMac
c# wpf listbox datatemplate
In my wpf project I’m using a datatemplate (which consists of a textblock) as an itemtemplate to my listbox. The itemsource is a List of which there are 6 items. How can I loop through the 6 textblock’s that are created at runtime?Thanks
-
Michael Hedgpeth
c# wpf datatemplate
In my application, I would like to have DataTemplates such that I can say:These are the DataTemplates for use in a TreeView These are the DataTemplates to use when showing the summary of an object These are the DataTemplates to use when showing detailsThe only way I’ve seen to be able to do this is to create a DataTemplateSelector and manually return the DataTemplate (possibly by a naming convention) for the class I need. Is there any more elegant way of handling this situation?
-
AwkwardCoder
wpf xaml datatemplate
How do I define a data template that will show a list of string values, the list length is unknown (onyl know at runtime)?
-
ReadMe
wpf merge datatemplate
I want to change DataTemplate’s content at runtime, the content is designed by enduser, and saved in a file as xaml format.the DataTemplate is defined like this:<DataTemplate x:Key=”DataTemplate1″><Grid><Canvas x:Name=”canvas1″ /></Grid> </DataTemplate>and the content designed by enduser like this:<Canvas x:Name=”canvas1″><Label …>… </Canvas>I want to meger the content designed by enduser to the datatemplate using code:DataTemplate templateObj
-
bsh152s
c# .net wpf mvvm datatemplate
This MVVM stuff is making my head hurt. I have an application which has a list of editors in a left pane. On the right is a tab control where the editors will be displayed. I have a main application view model that contains a collection of view models. I call this collection Workspaces. This is borrowed from the MvvmDemoApp that Microsoft provides here.public ObservableCollection<WorkspaceViewModel> Workspaces {get{…} }These workspaces are bound to a tab control in the main applicat
-
Gusdor
wpf datatemplate dynamicresource staticresource
Have I missed something in the step up from .net 3.5 to .net 4 because I’m seeing seemingly buggy behaviour that seems contrary to the goal of the system.I am trying to drum up a simple MVVM library for work using a few examples. I am consuming it within a Twitter client application for some additional learning and have hit a big stumbling block.The scenario is this. My root ViewModel (TwitterClientViewModel) object is given an instance of a DialogViewModel object for display. The DialogViewMode
-
user2622971
c# wpf datatemplate timepicker
In my Wpf app, I’ve two TimePickers. I’ve used binding for them but their time is not updating. I also want to set selected date for these TimePickers.I tried to bind it as below. But, it won’t work. Actual problem here is TimePickers are inside DataTemplate.Here is xaml:<DataTemplate x:Key=”EditableDataTemplate”><StackPanel Orientation=”Horizontal” Width=”596″><xctk:TimePicker Name=”StartPicker” Value=”{Binding StartValue, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=
-
Xyroid
c# windows-runtime microsoft-metro winrt-xaml datatemplate
How to dynamically create a DataTemplate with a UIElement in c# for windows 8 such as:<DataTemplate><Button /> </DataTemplate>To be done like this:DataTemplate dataTemplate = new DataTemplate(); … … …Thank You.
-
user1794863
listview binding datatemplate gridviewcolumn frameworkelementfactory
for example I can’t get result from this code! please help me, tnx. 🙂 GridViewColumn gvc6 = new GridViewColumn();gvc6.DisplayMemberBinding = new Binding(“sum”);FrameworkElementFactory txt = new FrameworkElementFactory(typeof(TextBox));txt.SetBinding(TextBox.TextProperty, new Binding()); // sets bindinggvc6.CellTemplate = new DataTemplate(typeof(string));gvc6.CellTemplate.VisualTree = txt;
-
Matthew
windows-phone-7 datatemplate bing-maps silverlight-toolkit pushpin
I am developing the mapping functionality of our WP7 application. currently the pushpins appear as a circle graphic. I am trying to create functionality to allow the user to be able to change the size of the circle of the pushpin, by sliding a bar. The idea being that the user can change the size of the pushpin anywhere between two sizes. Therefore I don’t want to create 2 or 3 pre-defined pushpin templates in XAML, and simply swap between them – I want to be able to modify an attribute of the t
-
Alex Janzik
wpf datatemplate skinning
I use MVVM architecture to decouple my application. That is, you often see something likevar u = new UserControl(); u.Content = new MyCustomType(); // MyCustomType is not a controlThe UI is defined via data templates that reside in resource dictionaries in their own XAML files<ResourceDictionary …><DataTemplate DataType=”{x:Type local:MyCustomType}”>…I load the resources at application startup and the application is happy to display my UI. But if I remove a data template and add
-
Dave Clemmer
wpf datatemplate
I have a DataTemplate defined as follows: I am accessing it at runtime using the code below: else{template = (DataTemplate)FindResource(“GridViewTextBlockDataTemplate”);var textblock = (TextBlock) template.LoadContent();textblock.Text = “bye”;//textblock.SetBinding(TextBlock.TextProperty, new Binding(“[” + current.Key + “]”));}var column = new GridViewColumn{Header = current.Key,CellTemplate = template };gridView.Columns.Add(column);}And now I want to change the textblock property to something
-
Nadav
wpf datagrid datatemplate datagridcell
I’ve written a DataTemplate:<DataTemplate x:Key=”ellipseTemplate”><Grid Margin=”4″><Grid.ColumnDefinitions> <ColumnDefinition Width=”*” /></Grid.ColumnDefinitions><Ellipse Height=”20″ Width=”20″ StrokeThickness=”5″ Stroke=”Black” Fill=”Gold”/></Grid></DataTemplate>And I want to set it to a DateGridCell.Template property in run time. I can access the cell and change its properties. I’m using MVVM so I don’t want to access it
-
Jonathan Perry
c# wpf datatemplate datatrigger templating
I’m trying to change a DataTemplate for objects in my WPF application according to a specific boolean value. When the value is “True” I want the DataTemplate to be something and when the value is “False” I want the DataTemplate to be something else.I’ve tried writing this code, but so far I end up with an annoying “Out of Memory exception”.<DataTemplate DataType=”{x:Type vm:MyObjectViewModel}”><DataTemplate.Triggers><DataTrigger Binding=”{Binding Visible}” Value=”False”><Set
-
Rouven Schäfer
c# windows-phone-7 events windows-phone-8 datatemplate
I know, how to create Datatemplates at runtime in c# Code:string xaml = @”<DataTemplate xmlns=””http://schemas.microsoft.com/winfx/2006/xaml/presentation”” xmlns:x=””http://schemas.microsoft.com/winfx/2006/xaml””> … … </DataTemplate>”;DataTemplate dt = (DataTemplate)XamlReader.Load(xaml);But how can i add Events to this Template and where should i define the Eventhandler.
-
akjoshi
wpf exception datatemplate wpfdatagrid frameworkelementfactory
I wrote a snippet to create a own DataTemplate by c# code. And i add it to datagrid column’s editing template. When i called object templateContent = tc.CellTemplate.LoadContent ( );, the application crashed, and throw me a exception which is “FrameworkElementFactory must be in a sealed template for this operation.”. This is the code i create my datatemplate.public override DataTemplate GenerateCellTemplate ( string propertyName ){DataTemplate template = new DataTemplate ( );var textBlockName =
-
Tekito
wpf visual-studio-2010 xaml datatemplate
I’m a relative novice when I comes to WPF, but I’m trying to create a reusable template for my Windows. The end goal is to have a template that can be applied to all dialog windows in my application, with customizable content. Ultimately I want the template to permit two different sections of content.Piecing together snippets from other web solutions this is what I have so far:A DataTemplate in my Application.xaml file. Still crude since I’m just trying to get it work:<DataTemplate x:Key=”
-
bjh
wpf datatemplate
I have a WPF TabControl with two TabItems. Each TabItem contains a ListBox with a separate ObservableCollection as its ItemsSource. Each ListBox has a different ItemTemplate. No matter which TabItem I set to be selected at startup, that tab will be displayed fine, but when I click on the other tab the application crashes with an ‘Exception has been thrown by the target of an invocation’ error pointing toward the DataTemplate for the tab I’m switching to. If I remove the ItemTemplate from the
-
JonathanWardRogers
xaml exception key datatemplate
I am receiving the error in a xaml resource file on build. Here is the xaml file:<ResourceDictionary xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”xmlns:s=”clr-namespace:DiagramDesigner”xmlns:c=”clr-namespace:DiagramDesigner.Controls”xmlns:r=”clr-namespace:Automation.Data;assembly=Automation”xmlns:a=”clr-namespace:Automation;assembly=Automation” ><DataTemplate x:Key=”WorkflowDropdownSetting”><DataTemplate.Re
-
Berryl
c# wpf data-binding reflection datatemplate
I wish I could be more descriptive in my title, but I am having trouble understanding the exception below.I had this happen recently, and it turned out to be a DependencyProperty that wasn’t properly declared, but I discovered that without the help of this exception.The only other thing I can add about it is that it happens when my GetHashCode method is invoked, which triggers a method that derives a hash by reflecting on the object’s public properties. In this case, the object is derived from a
-
Ashley Davis
c# wpf xaml datatemplate
How do I derive a new class from DataTemplate and then use it in place of DataTemplate?For example, in C#:public class DerivedDataTemplate : DataTemplate { }Then in XAML:<local: DerivedDataTemplate DataType=”{x:Type local:SomeType}”><Grid>… UI here …</Grid> </local:DerivedDataTemplate>When I try to use my derived data template class the follow exception is generated:System.Windows.Markup.XamlParseException was unhandled Message=”‘Grid’ object cannot be added to ‘Deriv
-
AnthonyWJones
silverlight silverlight-3.0 datatemplate
Requirement is to create a reusable multi-select combobox custom control. To accomplish this, I am creating the DataTemplate dynamically through code and set the combobox ItemTemplate. I am able to load the datatemplate dynamically and set the ItemTemplate, but getting unhandled exception (code: 7054) when combobox is selected.Here is the codeClass MultiSelCombBox: ComboBox{public override void OnApplyTemplate(){base.OnApplyTemplate();CreateTemplate();}void CreateTemplate(){DataTemplate dt = nu
-
Jonas Rembratt
wpf datatemplate
Since a few days back the WPF editor no longer works. Whenever I click somewhere in any editor it becomes disabled with this message: ‘NullReferenceException was thrown on “DataTemplate”: … (etc.)’I have spent a few hours trying to locate the problem without success so if anyone could give a hint on where to look I would greatly appreciate it.I have tried to debug with CLR exceptions enabled when thrown (VS2010->Debug->Exceptions…->Common Language Exceptions (Thrown) ‘Checked’) but I get no