Slider sldrRiskLevel = ilstMainTabPages[0].FindSingle<Slider>("./slider[@automationid='slider']");
double Max = sldrRiskLevel.MaxValue;
double Min = sldrRiskLevel.MinValue;
double Val = sldrRiskLevel.Value;
int intRandVal = new Random().Next((int)Min, (int)Max);
sldrRiskLevel.Value = intRandVal;
From Above code, I'm not getting any error. The value is set successfully. But the slider is not moving. Please help me on this problem. I've attached the snapshot of the slider control.
How to Set value for SilverLight Slider?
How to Set value for SilverLight Slider?
You do not have the required permissions to view the files attached to this post.
Regards,
Thangavel.S
Thangavel.S
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to Set value for SilverLight Slider?
Hi,
have you tried to use a double value instead of an integer:
Tobias
Support Team
have you tried to use a double value instead of an integer:
double RandVal = new Random().Next((int)Min, (int)Max);Regards,
Tobias
Support Team
Re: How to Set value for SilverLight Slider?
Thanks for your reply. I found that, this is UI error. After setting the value, The slider is not moving. but it's value is changing behind the code. It is fixed in code behind. Now the code is working. The following two approaches are working fine.
Approach1:
double RandVal = new Random().Next((int)Min, (int)Max);
sldrRiskLevel.Value = intRandVal;
Approach2:
int intRandVal = new Random().Next((int)Min, (int)Max);
sldrRiskLevel.Value = intRandVal;
Approach1:
double RandVal = new Random().Next((int)Min, (int)Max);
sldrRiskLevel.Value = intRandVal;
Approach2:
int intRandVal = new Random().Next((int)Min, (int)Max);
sldrRiskLevel.Value = intRandVal;
Regards,
Thangavel.S
Thangavel.S