-4

I want to be able to select datas which are not selectable in the following screenshot. I don't own the source code of that application, the code beside is just a sample, i would like to know if i can hack/hook it.

<TextBox x:Name="TextBoxtest"
         HorizontalAlignment="Left"
         Height="23"
         Margin="76,67,0,0"
         TextWrapping="Wrap"
         Text="Nom"
         VerticalAlignment="Top"
         Width="120"
         IsEnabled="False"/>

https://i.stack.imgur.com/GyriR.png

I'd like to know if it possible to hook or hack it in order to Enable it ?

What i would like is to make it selectable.

kurty
  • 1
  • 1
  • 1
    Welcome to Stack Overflow. Your question seems unclear to me. Please read [FAQ], [ask] and [help] as a start.. – Soner Gönül Sep 26 '14 at 12:48
  • What are you trying to achieve? If the application shows the textbox as disabled, it is entirely possible that being able to change its text does not mean that the changed value will even be transmitted into the underlying data model. The application does not expect any input there, why should it attempt to process it? – O. R. Mapper Sep 26 '14 at 12:49
  • Also, your code says `Text="Nom"`, but that is evidently not the case in your screenshot. – O. R. Mapper Sep 26 '14 at 12:51
  • I'm afraid that this is hard to do. If the target application is just based on win32/gdi, that means the `TextBox` is rendered as a small window, then you can get its `Handle` and use WIN32 API to do something with it (such as enable it). However in WPF application, all the controls ***don't*** have their own handle. Only the `Window` itself has a `Handle`. So it's really stuck. There is only UIAutomation supporting some way to interact with interfaces supporting it. But it's not enough, the interaction is very limited. At least you can get the Text of textbox but it's of course not selecting. – King King Sep 26 '14 at 17:19

1 Answers1

0

Set IsEnabled property to True,

 <TextBox Id="TextBoxtest" x:Name="TextBoxtest" HorizontalAlignment="Left" Height="23" Margin="76,67,0,0" TextWrapping="Wrap" Text="Nom" VerticalAlignment="Top" Width="120" IsEnabled="True"/>

Or By Coding, try this,

TextBoxtest.Enabled = true;
Afzal Ahmad
  • 586
  • 5
  • 20
  • 2
    It should be `IsEnabled` in the C# code, as well, not `Enabled`. – O. R. Mapper Sep 26 '14 at 12:52
  • Could i hook datas that are being sent to that textbox ? – kurty Sep 26 '14 at 13:12
  • What do you mean 'hook' You're being very unclear in what you want to do. – Nyra Sep 26 '14 at 13:14
  • http://stackoverflow.com/questions/467557/what-is-meant-by-the-term-hook-in-programming – kurty Sep 26 '14 at 13:26
  • I know what that is- I mean "what" do you want to do? Do you want to `hook` in when something changes on the textbox? On postback if some value of textbox has changed? No idea what you are asking. – Nyra Sep 26 '14 at 13:29
  • I can't copy/paste the value in that textbox because it seems to be disabled and i want to be able to do it without having the source code. That's all. So if possible , i'd like to hook the value of that textbox, or change the property of it. – kurty Sep 26 '14 at 13:32
  • ugh- you don't have enough rep to chat yet. It is very unclear what you want to do. If you can think of a way to better word it, more help may follow, but as is no idea how to help you. If the textbox is enabled then you should be able to copy/paste. For `doing something` with it... Whatever drives the postback, in that event capture the TextBox.Text to some string and do something with it. – Nyra Sep 26 '14 at 13:40
  • @alykins: [The version of MSDN I am looking at](http://msdn.microsoft.com/en-us/library/system.windows.uielement.isenabled%28v=vs.110%29.aspx) says about `IsEnabled`: "Gets or sets a value indicating whether this element is enabled in the user interface (UI)." Sounds quite writeable to me. [`TextBox`](http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox%28v=vs.110%29.aspx) doesn't even have a property called `Enabled`. – O. R. Mapper Sep 26 '14 at 14:31
  • @alykins: You're looking at the documentation of the ASP.NET controls in the `System.Web.UI.WebControls` namespace. That's the wrong place to look when the question specifies that WPF (at home in the `System.Windows.Controls` namespace) is the UI toolkit being used. Be aware that .NET comes with several UI toolkits, such as WPF, WinForms, and ASP.NET. – O. R. Mapper Sep 26 '14 at 14:54
  • @O.R.Mapper ah- yes; would help if I look at the correct namespace. Thank you for pointing that out- I removed my inaccurate comments. It is again odd to me that they would have significant differences for common objects like this. What I mean is to me, every .net TextBox control should have the same access logic, so this as perfect example (IMO) should be uniform across all namespaces for IsEnabled|Enabled for TextBox controls. – Nyra Sep 26 '14 at 15:15
  • 1
    @alykins: One reason may be that the UI toolkits were developed at very different times. WPF came a while after WinForms, and one of its goals certainly was to not repeat mistakes made in WinForms, which would directly result in API differences. Another reason may be that the contexts of use of the UI toolkits can be quite different (or else only one such toolkit would suffice); web-based controls may feature a totally different internal messaging logic than desktop-based controls, which shows in their API. – O. R. Mapper Sep 26 '14 at 15:53