Click here to Skip to main content
15,913,610 members
Home / Discussions / WPF
   

WPF

 
GeneralCasting the net ... Pin
Gary Ranson1-Oct-11 22:32
Gary Ranson1-Oct-11 22:32 
GeneralRe: Casting the net ... Pin
Pete O'Hanlon3-Oct-11 0:50
mvePete O'Hanlon3-Oct-11 0:50 
QuestionSilverlight3, VS2008 Pin
DuttaSandip4U30-Sep-11 23:08
DuttaSandip4U30-Sep-11 23:08 
AnswerRe: Silverlight3, VS2008 Pin
Abhinav S30-Sep-11 23:24
Abhinav S30-Sep-11 23:24 
QuestionSilverlight slider - binding lost when value is out-of-range Pin
Wjousts29-Sep-11 8:41
Wjousts29-Sep-11 8:41 
AnswerRe: Silverlight slider - binding lost when value is out-of-range Pin
killabyte29-Sep-11 17:23
killabyte29-Sep-11 17:23 
GeneralRe: Silverlight slider - binding lost when value is out-of-range Pin
BobJanova30-Sep-11 4:45
BobJanova30-Sep-11 4:45 
GeneralRe: Silverlight slider - binding lost when value is out-of-range Pin
Wjousts30-Sep-11 10:08
Wjousts30-Sep-11 10:08 
Here's a simple test for you:

HTML
<UserControl x:Class="SLSliderDemo.MainPage"
             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/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:local ="clr-namespace:SLSliderDemo"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <local:Data x:Key="data"/>
    </UserControl.Resources>
    <StackPanel x:Name="LayoutRoot" Background="White" DataContext="{StaticResource data}">
        <Slider Minimum="0" Maximum="10" Value="{Binding CurrentValue, Mode=OneWay}" IsEnabled="False"/>
        <TextBlock Text="{Binding CurrentValue, StringFormat=Current Value \{0\}}"/>
        <TextBox Text="{Binding CurrentValue, Mode=TwoWay}"/>
        <TextBox/>
    </StackPanel>
</UserControl>


And the data class:

C#
namespace SLSliderDemo
{
    public class Data : INotifyPropertyChanged
    {
        private double currentValue;

        public double CurrentValue
        {
            get { return currentValue; }
            set 
            { 
                currentValue = value;
                OnPropertyChanged("CurrentValue");
            }
        }


        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}


Run the demo - type 5 in the first text box. Slider moves half way, text block shows 5. Set the first text box to 7. Slider moves, text block shows 7. Set the first text box to 11. Slider moves to the end, text block shows 11. Set the first text box back to 2. Text block shows 2, slider is now stuck at 10.
GeneralRe: Silverlight slider - binding lost when value is out-of-range Pin
Wjousts30-Sep-11 9:55
Wjousts30-Sep-11 9:55 
QuestionWPF combobox selecteditem issue Pin
PretzelB29-Sep-11 5:34
PretzelB29-Sep-11 5:34 
AnswerRe: WPF combobox selecteditem issue Pin
Ian Shlasko29-Sep-11 5:57
Ian Shlasko29-Sep-11 5:57 
GeneralRe: WPF combobox selecteditem issue Pin
PretzelB29-Sep-11 6:19
PretzelB29-Sep-11 6:19 
GeneralRe: WPF combobox selecteditem issue Pin
Ian Shlasko29-Sep-11 8:43
Ian Shlasko29-Sep-11 8:43 
GeneralRe: WPF combobox selecteditem issue Pin
PretzelB29-Sep-11 9:31
PretzelB29-Sep-11 9:31 
GeneralRe: WPF combobox selecteditem issue Pin
Ian Shlasko29-Sep-11 10:32
Ian Shlasko29-Sep-11 10:32 
AnswerRe: WPF combobox selecteditem issue Pin
Simon Bang Terkildsen29-Sep-11 8:07
Simon Bang Terkildsen29-Sep-11 8:07 
GeneralRe: WPF combobox selecteditem issue Pin
PretzelB29-Sep-11 9:27
PretzelB29-Sep-11 9:27 
QuestionHow to use WPF to implement multi-pen drawing? Pin
rehuo28-Sep-11 21:58
rehuo28-Sep-11 21:58 
AnswerRe: How to use WPF to implement multi-pen drawing? Pin
rehuo5-Oct-11 20:02
rehuo5-Oct-11 20:02 
QuestionHow to get WM_Gesture messages in WPF4.0 touch aware application? Pin
manil kumar28-Sep-11 21:15
manil kumar28-Sep-11 21:15 
QuestionListBox Binding Pin
Samir.Sh28-Sep-11 20:46
Samir.Sh28-Sep-11 20:46 
GeneralRe: ListBox Binding Pin
Samir.Sh29-Sep-11 20:16
Samir.Sh29-Sep-11 20:16 
QuestionObsolete Examples Pin
michaelbarb28-Sep-11 8:53
michaelbarb28-Sep-11 8:53 
AnswerRe: Obsolete Examples Pin
AnnieMacD28-Sep-11 10:05
AnnieMacD28-Sep-11 10:05 
GeneralRe: Obsolete Examples Pin
michaelbarb28-Sep-11 10:21
michaelbarb28-Sep-11 10:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.