<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>
Regex rg = new Regex("a(a)|b(b)");
Console.WriteLine(rg.Match("aa"));
Console.WriteLine(rg.Match("aa").Groups[1].Value);
Console.WriteLine(rg.Match("bb"));
Console.WriteLine(rg.Match("bb").Groups[1].Value);
Console.WriteLine(rg.Match("bb").Groups[2].Value);
aa
a
bb
b
<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>
<Window x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="47*"/>
<RowDefinition Height="275*"/>
</Grid.RowDefinitions>
<TextBox x:Name="filter" TextChanged="filter_TextChanged"/>
<ListBox x:Name="lst" Grid.Row="1" />
</Grid>
</Window>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
List<string> lstSource = new List<string>() { "1", "2","3" };
viewSource = new CollectionViewSource();
viewSource.Source = lstSource;
viewSource.Filter += viewSource_Filter;
lst.ItemsSource = viewSource.View;
}
CollectionViewSource viewSource;
void viewSource_Filter(object sender, FilterEventArgs e)
{
e.Accepted = ((string)e.Item).IndexOf(filter.Text) >=0;
}
private void filter_TextChanged(object sender, TextChangedEventArgs e)
{
viewSource.View.Refresh();
}
}
//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>
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ItemsControl x:Name="itemsData">
<ItemsControl.ItemTemplate>
<DataTemplate>
<ItemsControl BorderBrush="Black" BorderThickness="1" ItemsSource="{Binding}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<ItemsControl BorderBrush="Black" BorderThickness="1" ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=.}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Window>
namespace WpfApplication1
{
/// <summary>
/// Логика взаимодействия для MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var my = new MyClass();
my.Data = new List<byte[][]>();
my.Data.Add(new byte[][] { new byte[] { 0, 1 }, new byte[] { 2, 3 }, new byte[] { 4, 5 } });
my.Data.Add(new byte[][] { new byte[] { 6, 7 }, new byte[] { 8, 9 }, new byte[] { 10, 11 } });
itemsData.ItemsSource = my.Data;
}
}
public class MyClass
{
public List<byte[][]> Data
{ get; set; }
}
}
System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml("Red");
System.Drawing.Color color = System.Drawing.Color.FromName("Red");
System.Drawing.Color wfColor = System.Drawing.Color.FromName("Red");
System.Windows.Media.Color color = System.Windows.Media.Color.FromArgb(wfColor.A,wfColor.R,wfColor.G,wfColor.B );
<ScrollViewer VerticalScrollBarVisibility="Auto" IsHitTestVisible="False" >
<TextBlock TextWrapping="Wrap" Text="{Binding FirstInformation}"/>
</ScrollViewer>
<ScrollViewer VerticalScrollBarVisibility="Auto" >
<TextBlock TextWrapping="Wrap" Text="{Binding FirstInformation}" MouseLeftButtonUp="TextBlock_MouseLeftButtonUp"/>
</ScrollViewer>
private void TextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
var tb = sender as TextBlock;
// Нужно дополнительно обложиться проверками, что типы совпадают
((tb.Parent as ScrollViewer).Parent as RadioButton).IsChecked = true;
}