c# - Check if the string entered is between 00-FF in WPF -
c# - Check if the string entered is between 00-FF in WPF -
i have textbox in xaml page . , have property info in view model. need check if info entered user in between 00-ff (hex values).
i know range validator help other mention in class. if integer of string entered lesser 256 below ff.
in xaml page
<textbox name="txtfilldata" isreadonly="false" background="white" foreground="black" text="{binding data}"/>
in viewmodel class
private string _data; public string info { { homecoming _data; } set{_data=value;} } void validatevalues() { if (data==null||data=="") { messagebox.show("all values need in hex format!"); } else if(data.length>2) { messagebox.show("fill must byte value!"); } int decagain = int.parse(data, system.globalization.numberstyles.hexnumber); }
i need give status check if value entered between 00-ff. help appreciable.
thanks in advance!
as ensuring string contains hexadecimal characters. below link should help already:-
check string see if characters hexadecimal values c# wpf validation xaml mvvm
Comments
Post a Comment