<TextBox Text="{x:Static local:ClassG.TText ></TextBox>
<Window x:Class="WpfApplication1.MyWindow" ... >
</Window>
<local:MyWindow x:Class="WpfApplication1.MyChildWindow"
xmlns:local="clr-namespace:WpfApplication1"
... >
</local:MyWindow>
class MyChildWindow : MyWindow
{
}
pack://application:,,,/ConfigWPF;component/saveButton.Image.png
<StackPanel DataContext="{x:Static local:MyClass.MyFirstAnketa}">
<TextBox Text="{Binding Name}" />
<TextBox Text="{Binding DateBirthday}" />
</StackPanel>
<ItemsControl ItemsSource="{Binding Path=MixedList}">
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type local:MyFirstClass}">
<StackPanel><TextBox Text="{Binding Name}" /></StackPanel>
</DataTemplate>
<DataTemplate DataType="{x:Type local:MySecondClass}">
<StackPanel>
<TextBox Text="{Binding Property1}" />
<TextBox Text="{Binding Property2}" />
</StackPanel>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
<CheckBox Margin="5,0,0,0" IsChecked="{Binding Check, Mode=TwoWay}" >
<ListBox x:Name="lst">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding Value}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
lst.ItemsSource = new List<KeyValuePair<int, string>>()
{
new KeyValuePair<int, string>(1, "1"),
new KeyValuePair<int, string>(2, "2"),
};
class MyClass
{
public int id { get; set; }
public string Name { get; set; }
public bool IsChecked { get; set; }
}
<ListBox x:Name="lst">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding Name}" IsChecked="{Binding IsChecked}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
lst.ItemsSource = new List<MyClass>()
{
new MyClass(){id=1, Name="1"},
new MyClass(){id=2, Name="2"},
};
foreach(var tObj in (lst.ItemsSource as List<MyClass>).Where(myObj => myObj.IsChecked))
MessageBox.Show(tObj.Name);
<ObjectDataProvider x:Key="userDCustom" ObjectType="{x:Type local:UserData}">
<ObjectDataProvider.ConstructorParameters>
<local:User>
<local:User.UserData>
<local.User Name="MyName" />
</local:User.UserData>
</local:User>
</ObjectDataProvider.ConstructorParameters>
</ObjectDataProvider>
<Button >
<Run>
<Run.Style>
<Style TargetType="Run">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="TextDecorations" Value="Underline" />
</Trigger>
</Style.Triggers>
</Style>
</Run.Style>
Текст
</Run>
</Button>
//this = currentObject;
//typeof(this) == typeof(Reader);
var indexBinding = new Binding();
indexBinding.Mode = BindingMode.TwoWay;
//указываю подчненный контролл как источник данных
indexBinding.ElementName = "epubConrol";
indexBinding.Path = new PropertyPath("SelectedIndex");
//Очищаю свойство зависимостей и создаю привязку
currentObject.ClearValue(Reader.SelectedIndexProperty);
currentObject.SetBinding(Reader.SelectedIndexProperty, indexBinding);
<ListBox x:Name="lst1" SelectedIndex="{Binding ElementName=lst2, Path=SelectedIndex, Mode=TwoWay}">
<system:String>1 строка</system:String>
<system:String>2 строка</system:String>
</ListBox>
<ListBox Grid.Column="1" x:Name="lst2">
<system:String>1 строка</system:String>
<system:String>2 строка</system:String>
</ListBox>