Questions tagged [xaml-binding]
52 questions
3
votes
2 answers
DataBinding for custom ContentView works in Code behind, but not Xaml
I am trying to make a custom ContentView for a control that works similar to Bootstrap's Navigation Pills.
Here is the code for my custom view.
PillToggle.xaml.cs
public partial class PillToggle : ContentView
{
public PillToggle()
{
…

Dave
- 3,676
- 4
- 28
- 39
3
votes
3 answers
Binding Commands to Button Inside ItemTemplate
Hello I am trying to bind a command to a button inside a LongListSelector's ItemTemplate. But facing binding problems. Here are my codes-
XAML
…

Lamia Mehreen
- 759
- 1
- 8
- 15
2
votes
2 answers
.NET Maui SwipeItem command binding to viewmodel ancestor fails
I have the following XAML

Stephen York
- 1,247
- 1
- 13
- 42
2
votes
1 answer
UWP XAML and C# - x:Bind on a DataTemplate inside a ResourceDictionary
Context: I'm writing a UWP Twitter client. One of the properties of my Tweet class is a bool called IsRetweet - if the tweet contains a retweet, this is set to True.
I want to use this with x:Load in order to conditionally load an extra row in my UI…

CXL
- 1,094
- 2
- 15
- 38
2
votes
1 answer
Background color not being set with binding and converter in UWP app
I try to set the background color of a listitem (or for testing purposes the text foreground color of a TextBlock) in a UWP app using binding to a property of the binded item (TimeEntry).
This is the Xaml for the ListView which is bound to a…

Patric
- 2,789
- 9
- 33
- 60
2
votes
1 answer
XAML bind SelectedItem to a DataContext.listbox reference
I stuck in a Problem:
I have a PopUp window, its DataContext points to an object which holds a reference to a ListBox (reftolistbox).
I managed to create a working binding with this codebehind code:
private void ID_Loaded(object sender,…

alexn234
- 85
- 1
- 6
2
votes
1 answer
WPF TabItem - Image Binding
Issue
I am trying to bind an Image from my TabItem to my TabControlResource section but I cannot seem to do this. The Header text is fine as the TabItem has a Header attribute but there is nothing I can add my image to.
Code
Here is the whole of…

Ben Clarke
- 1,051
- 4
- 21
- 47
2
votes
1 answer
Can binding be used in XAML within a Style?
I wrote a sample to see if binding could be used within a Style in a blank Windows Store app - it compiled but did not work exactly as I'd hoped. I'm relatively new to XAML and binding so may have missed something.
In the sample below there are two…

Tofa
- 21
- 4
2
votes
3 answers
How to Assign ListBox Selected Items to Source Propertey
I want when a user selects one or multiple items that my source property gets updated. I have tried with the binding mode OneWayToSource but this is not helping. Below is the XAML and ViewModel code:

Simsons
- 12,295
- 42
- 153
- 269
1
vote
0 answers
How to handle missing XAttributes in WPF data bindings?
I've got a WPF application that reads an XML file and creates an XDocument to bind to, passing its various elements down to other UI elements via DataContexts and such. The schema for the XML this application reads marks a few attributes on elements…

p0lar_bear
- 2,203
- 2
- 21
- 31
1
vote
2 answers
UWP Two Radio Buttons using two-way binding stop working after page navigation
I have two radio buttons which are using two-way binding to two boolean properties, X and Y of my view model. Since radio buttons are mutually exclusive, setting X automatically clears Y and vice versa. Now, if I navigate to a different page, then…

ArtZaqX__
- 13
- 4
1
vote
2 answers
Custom Render not being used on Bindable property update
Please consider the following issue.
In my Xamarin.Forms app I have a custom render for UWP that allows for a button to have two lines, and be centralised.
The buttons in questions are items in a Listview that are bound to objects. When they are…

Aphire
- 1,621
- 25
- 55
1
vote
0 answers
Send Page as CommandParameter in Xamarin Forms
I have a Button on a MasterDetailPage and would like to send the MasterDetailPage to the Button Command as the CommandParameter, so that I can change the Detail Property of the MasterDetailPage from the ViewModel. Please let me know if I am…

Failwyn
- 767
- 8
- 22
1
vote
2 answers
How to bind ToolTip content in a custom textblock styles property setter
I am trying to create a textblock that shows a tooltip of the textblock's text when its being trimmed. I have the actual visibility part of this taken care of in a converter. My problem is binding the ToolTip's content to its partent textblock's…

Derek Meyer
- 497
- 7
- 22
1
vote
2 answers
Binding to Dependency Properties within ItemsControl
I have an ItemsControl with an inline ItemsSource as below (simplified):
…

Chris
- 5,882
- 2
- 32
- 57