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 going to change from Person to Person, how can this parameter be set every time?
WPF Binding to a method with parameter inside HierarchicalDataTemplate
7.5k views Asked by Dested At
1
There are 1 answers
Related Questions in WPF
- Sorting a List by its property renames all the objects in the List
- Can't open new instance of another window in my app, in WPF .NET 8
- Binding forecolour and ToolTip to a DataGrid
- how to create Infinite Upgrades in a clicker game
- Try Catch exception is not catching the unhandled exception
- Assigning an object to another doesn't raise PropertyChanged event in WPF
- Masking input in TextBox
- What should I do if Visual Studio has a restriction on creating files with a long name or a long path to these files?
- reading configuration file (mytest.exe.config)
- WPF Windows Initializing is locking the separated thread in .Net 8
- How to bind to the DataContext ViewModel of another view?
- mouse coordinates in image go below 0 and above width
- WPF pop up is behaving differently in English language PC and Japanese language PC
- Multi level project reference using dll
- Unable to unzip archive .NET framework
Related Questions in BINDING
- x:Bind a embeded page to the parent window viewmodel in WinUI 3
- ERR_EMPTY_RESPONSE with docker container port bind
- Angular: Two way binding and Event binding not working
- Cannot find protocol declaration for 'TransactionHandlerDelegate'" (Swift/MAUI Interop)
- How to make Two Header Rows for table in UI5
- Synchronize a bindable property with a command
- RStudio throws continuous "Error: bad binding access " errors and has to be killed
- wpf bind all sliders ‘ IsEnabledProperty in a array
- WPF TextBox set common StringFormat for all controls
- How to bind using BindingReducer to subset of the childstate using tca
- Is there a way to bind a Function to a Tabview change in CustomTkinter?
- Bindings not found
- WPF property declared in C# code instead of XAML
- How can I create a framewrok from a native iOS library?
- How to bind the other "Enter" on the keyboard in python tkinter?
Related Questions in DATATEMPLATE
- MAUI ItemsControl+DataTemplates (like WPF)?
- WPF - how to set the correct DataContext for custom UserControls from DataTemplate
- Can a DataTemplate be reused by binding it to different properties with the same data type?
- GridViewColumn DataTemplate: context doesn't take from the ListView ItemSources
- I am having problems with httpClient.GetAsync calling Rest Service in .NET MAUI
- How to x:Bind to xaml root object's member from DataTemplate in WinUI?
- WPF XAML DataGridTemplateColumn assign to two DataTemplate with conditional types
- Having a Usable Combobox Inside a Listbox Item
- Filtering a ComboBox in a DataGrid based on another combobox in the datagrid in WPF C#?
- How to pass DataGridColumn as a command parameter ? (WPF)
- Change Visibility of Controls Based Upon What Is Selected In a List View
- DataTemplate inside ListView (with VirtualizingStackPanel) causing StackOverflow
- User-Provided DataTemplate
- MVVM dynamic view with different controls
- Changing Button's content to DataTemplate based on ViewModel property
Related Questions in HIERARCHICALDATATEMPLATE
- TreeView with multiple HierarchicalDataTemplates
- WPF TreeView shows objects instead of their names
- Use TreeView hierarchy with HierarchicalDataTemplate from inside a DataTemplate
- How to set HierarchicalDataTemplate in Syncfusion:SfTreeView
- Example for WPF Treeview data binding
- Binding data onto a TreeView in WPF with one Model class
- WPF TreeView MVVM using HierarchicalDataTemplate is strange updating like same word
- What's the proper way to build a data template for a TreeView node that contains multiple collections as children?
- How to get the Content of selected Menu Item?
- How to add Scrolling to the HierarchicalDataTemplate items inside TreeView?
- How to move xaml code inside HierarchicalDataTemplate to a resource
- One template for multiple similar HierarchicalDataTemplate-s?
- Conditionally show WPF Treeview levels
- How to Remove an Item from HierarchicalDataTemplate on a treeview
- Unable to set Custom TreeView's Selected Item in Treeview programmtically
Related Questions in OBJECTDATAPROVIDER
- how to pass more parameters using TestNG DataProvider (csv)
- Why Binding DataTable doesn't work in XAML
- WPF XAML x:Type is underlined and states "MyColor" does not exist in the namespace .... Why?
- WPF binding to result of method with parameter for listview column
- Where to add ObjectDataProvider in Application.Resources with ResourceDictionary
- C# WPF binding to method with ObjectDataProvider
- Pass Tuple to ObjectDataProvider parameters
- WPF ObjectDataProvider Parameters
- How to refresh a DataGrid that has been populated by a DataProvider every 1min
- The property was not found in ObjectdataProvider
- Object as Constructor Parameter to DataContext in XAML
- ObjectDataProvider error finding prism classes and constructor parameters
- WPF: Convert integer to bool using ObjectDataProvider
- Strange behavior of markup extension. Does it not work in design mode?
- How to use an ObjectDataProvider to bind an enum to a ComboBox in XAML
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
The best way to do this is with a converter.
Then you just need to set up the binding.