Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I recomand you to use element binding and converter to convert value from 02x09. so your one textbox will have first halp and second will have other half.</p> <p>here is a sample code. for you.</p> <pre><code>&lt;Window x:Class="WPFTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converters="clr-namespace:WPFTest" Title="MainWindow" Height="350" Width="525"&gt; &lt;Window.Resources&gt; &lt;converters:MyConverter x:Key="converter"/&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;ListBox ItemsSource="{Binding Items}" Margin="0,0,360,0" x:Name="list"&gt; &lt;/ListBox&gt; &lt;TextBox Text="{Binding Path=SelectedValue,Converter={StaticResource converter},ConverterParameter=0, ElementName=list}" Height="25" Width="100"/&gt; &lt;TextBox Text="{Binding Path=SelectedValue,Converter={StaticResource converter}, ConverterParameter=1,ElementName=list}" Height="25" Width="100" Margin="208,189,209,106"/&gt; &lt;/Grid&gt; &lt;/Window&gt; public partial class MainWindow : Window { public List&lt;string&gt; Items { get; set; } public MainWindow() { InitializeComponent(); if (Items == null) Items = new List&lt;string&gt;(); Random ran = new Random(); for (int i = 0; i &lt; 10; i++) { Items.Add(ran.Next(1, 5) + "x" + ran.Next(5, 10)); } this.DataContext = this; } } public class MyConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null) return "Null"; var values = value.ToString().Split(new string[] { "x" }, StringSplitOptions.None); int x = 0; if (int.TryParse(parameter.ToString(), out x)) { return values[x].ToString(); } return "N/A"; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload