Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

ComboBox Editable Percentage

$
0
0

Hello 

i have Slider in WPF

<Slider   x:Name="slider"   Minimum="0.25" Maximum="4" Padding="0,0,0,0"   Margin="0,0,0,0"  Width="52"     SmallChange="1" ValueChanged="slider_ValueChanged"  ></Slider>


i display value in ComboBox

<ComboBox x:Name="myComboBox" HorizontalAlignment="Left"    Foreground="#333" Width="70"  Margin="35,8,0,8" IsEditable="True"    Text="{Binding ElementName=slider,Path=Value, StringFormat=p0}" ItemsSource="{Binding zoomVal}" Background="Black" SelectionChanged="myComboBox_SelectionChanged"    ><ComboBox.ItemTemplate><DataTemplate><TextBlock Text="{Binding StringFormat=P0}"/></DataTemplate></ComboBox.ItemTemplate></ComboBox>

by default , i set comboBox Value like this 

  public List<double> zoomVal = new List<double>();

            zoomVal.Add(4);
            zoomVal.Add(3);
            zoomVal.Add(2);
            zoomVal.Add(1);
            zoomVal.Add(0.75);
            zoomVal.Add(0.50);
            zoomVal.Add(0.25);

   myComboBox.ItemsSource =  zoomVal;

Actually, the comboBox value changes when slider Tick moving.

and when we select value in ComboBox Dropdown list, the slider changes too.

Here is my issue.

i set ComboBox as Editable and i display value in percentage.

 if I enter for example "2"  , it is the "equivalent of 200 but I would like to type "200 "before the slider is moving on " 2".

How can i do that.

I hope you understand my question and you can help me.

Thanks


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>