![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | 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 | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Binding to a Foreign Key Binding? | -=B3N=- | Avalon | 0 | 06-14-2007 06:45 AM |
| Binding Question (Binding in General) | Jason | Avalon | 2 | 05-09-2007 04:41 AM |
| WPF binding error when databinding a ComboBox inside a ListView it | jeff.townes | Avalon | 0 | 05-01-2007 11:05 AM |
| Cmdlet Parameter Binding Question | Keith Hill [MVP] | PowerShell | 13 | 12-10-2006 10:22 PM |
| Binding Question | Bree | Avalon | 4 | 12-06-2006 09:08 AM |