wpf-binding

How to set selected value path to tab header text in a tab control in WPF.

The title really says it all here. I am a little unclear on how I would set the SelectedValuePath of a TabControl to the text of the selected TabItems header. I feel like this should be fairly simple, and probably involves content.something but I have always been a bit confused about the Content property. Thanks ...

How to databind Frame UriSource from two sources???

I need to create a navigation model where I can load content from listbox menu into frame and at the same time by clicking a usercontrol or a button in the loaded into frame page. I can successfully navigate by clicking menu items. However, I cannot do the same when I initiate page load into frame from already loaded page into frame. I a...

WPF Binding Confusion, combo box trying to change selected value before values loaded?

Why isnt this selected value binding working? I am utterly confused here. When I load the page, the first text box properly shows the contents of 'SelectedComponentAnalysisViewModel.ReacEffectViewModel.Note.NoteID', in this case '20'. What SHOULD happen is when the page is first loaded, the combobox should have the note with ID 20 prese...

Static verification of bindings

Or "how do you make sure all your bindings stay correct?" (this is kinda lengthy, but bear with me, I tried to make it as short as I could) Consider the following example: <TextBox Name="tb" /> <TextBlock Text="{Binding Text.TheProp, ElementName=tb}" /> It is perfectly known at compile time that the binding is incorrect (i.e....

Binding is not updated as expected

Hello, I'm building a simple UserControl, DoubleDatePicker, which defines a DependencyProperty, SelectedDate : DoubleDatePicker.xaml : <UserControl x:Class="TestWpfDoubleDatePicker.DoubleDatePicker" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:toolkit="h...

Binding Grid Height Using FindAncestor and AncestorLevel To Another Grid

My question is with respect to properly binding the property of one element to another. Here is the structure of my code: (1) Data Template contains a grid (let's called the grid GridA), and in the grid, I specify an instance of a control, called ControlA. (2) ControlA is a UserControl that contains a Grid. There is custom logic in C...

Xml binding With Treeview.

I have a xml file and i want to bind it with a tree view.But problem is that i want to bind it with the text of the perticular node and want to skip other nodes.but i am facing problem. My xml file is like this Add-Entity Adds an entity to the specified table in Azure Table storage. Add Entity ...

DataGridComboBoxColumn ItemSource Binding Doesn't work

In all of the examples of DataGridComboBoxColumn ItemSource comming from the Resources. Couldn't it be binding directly to a list in the CodeBehind ? ...

XAML reference control and properties in x:Array

<RichTextBox x:Name="OrigText" Margin="0,0,8,0" d:LayoutOverrides="Width"/> <Button x:Name="OrigFileBrowse" Command="{Binding BrowseCommand}" CommandParameter="{Binding ElementName=OrigText, Path=Document}" HorizontalAlignment="Center" Margin="0,0,8,2.442" Width="75" Content="Browse" Grid.Row="1" d:LayoutOverrides="Height"/> <Ric...

Tab order and index in WPF usign the MVVM pattern

I'm having an issue with tabbing through the controls on a WPF application using the MVVM pattern. I have the following XAML which defines a tree structure <Grid Background="Transparent" Margin="10"> <TreeView ItemsSource="{Binding FirstLevelNavigableViewModels}" Background="Transparent" HorizontalContentAlignment="St...

WPF FlowDocument Binding

I am using Microsoft's XAML/HTML converter to convert HTML from a database into a XAML string. The Microsoft converter seems to be formatting the text correctly, but I'm having trouble binding the output to a XAML object. For example, using the following HTML: <span style="font-weight: bold; font-family: Georgia; color: rgb(0, 96, 144...

Why doesn't this SetBinding ImageSourceProperty Work?

let mtvCapView = Rendering.MTViewerCaptureViewProvider(subRead) let image = Image() let imageBinding = Data.Binding("ImageElement") imageBinding.Source <- mtvCapView image.SetBinding(Image.SourceProperty, imageBinding) .... Grid.SetColumn(image, 1) grid.Children.Add(image) The MTViewerCaptureViewProvider class exposes an property ...

Is that possible to make one of the Listboxitems to be not selectable?

I generate listbox items from xml. I need one of the items to be not selectable? Is that possible to achieve it coding only in XAML? Thank you in advance. ...

How to connect text box's keyboard Enter event to a button click command in wpf mvvm.

I have a search text box and a button named search. Now i have a command associated with button which search data based on text box's text. I want when user press "Enter" key then same thing should happen as click on search button. I am using MVVM pattern so how to do this. ...

WPF C# binding code - why doesn't this simple example work?

Hi, I've attached some WPF C# binding code - why doesn't this simple example work? (just trying to understanding binding to a custom object). That is when clicking on the button to increase the counter in the model, the label isn't updated. <Window x:Class="testapp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/x...

WPF radio button binding - getting an error in this code here??

Trying to get radiobuttons binding working but getting a run time error with the code below. Want the radio buttons to act such that only one can be selected at a time, and that they bind correctly in a 2 way fashion. Error text is. "The invocation of the constructor on type 'testapp1.MainWindow' that matches the specified bin...

Unable To Bind VisualBrush's Visual To ViewModel

I have a TabControl whose ItemsSource property is bound to an ObservableCollection of ViewModels. What I want is to have a Rectangle whose Fill is a VisualBrush - and binding the VisualBrush's Visual to the SelectedItem of the TabControl. When I do this, I get a binding error stating: "'ObjectSourceConverter' converter failed to conve...

Forcing Binding Validation in WPF

I want to validate all the TextBox controls on the page load event. I'm aware of one method to do this. Here's what I used. BindingExpression bx = myTextBox.GetBindingExpression( TextBox.TextProperty ); if(bx != null) bx.UpdateSource(); I have a custom ValidationRule that checks if a field is required or not for some of my TextBo...

WPF Treeview Databinding Hierarchal Data with mixed types

I have a bit of a complex situation with WPF Treeview Binding. I have spent the last 2 days trying Google it, and this is the closed I came up with, but it doesn't solve the issue. Here is the situation: I have an object that looks like this: public class Category { public string Name { get; set; } public List<Category> Categorie...

WPF DataContext ... looking for the simplest syntax.

In the following XAML UserControl I am binding a few items to properties in the UserControl's linked class. <UserControl x:Class="Kiosk.EventSelectButton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Kiosk" Height="130"...