![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Binding inside binding question Hi, I want to bind Text property of TextBox to a dictionary where key is a name of the TextBox. (I want to make a Style out of that and use it for a number of TextBoxes). The binding does not work. (exception in debugger). Can someone please advise ? Here is my Xaml: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:LableList="clr-namespace:LableList" x:Class="LableList.Window1" x:Name="Window" Title="Window1" Loaded="WindowLoaded" Width="640" Height="480"> <Grid x:Name="LayoutRoot"> <TextBox x:Name="QType"> <TextBox.Text> <Binding Source="{x:Static Application.Current}" Path="MainWindow.DataMap[{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Name}].Data"/> </TextBox.Text> </TextBox> </Grid> </Window> And here is the c# code: namespace LableList { public partial class Window1 { private Dictionary<string, Value> _DataMap = new Dictionary<string,Value>(); public Dictionary<string, Value> DataMap { get { return _DataMap; } } public Window1() { DataMap.Add("QType", new Value("QType", "aaaaa")); this.InitializeComponent(); } } public class Value { public Value(string iName, string iData) { _Name = iName; _Data = iData; } private string _Name; public string Name { get { return _Name; } set { _Name = value; } } private string _Data; public string Data { get { return _Data; } set { _Data = value; } } public override string ToString() { return Data; } } } |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Cmdlet Parameter Binding Question | PowerShell | |||