how to check usercontrol is allready invock or not
-
Tuesday, May 01, 2012 9:19 AM
hello,
in my application i m open a keyboard on textbox click . the keyboard i am creating a custom user control now when i touch on textbox then keyboard open .
the problem is how i check keyboard is already open or not when i touch twice time
Dharmesh Sharma info@dharmeshsharma.com www.dharmeshsharma.com
All Replies
-
Tuesday, May 01, 2012 9:26 AM
Hello,
This depands on how you show your custom control.
Please provide some more information about this:
Do you show your control in a ScatterViewItem?
If not where do you add it to your visible collection?You could also think about making your keyboard singleton and give it a "Visible" property.
But your current question does not provide enough information to give an answer.
Roy Janssen - Semper IT Services (Please mark an answer as "answered" if it does help you!)
-
Tuesday, May 01, 2012 10:04 AM
Hello,
this is my code i m try to show my custom control
private void AddressBoxBrowserNumber01_TouchDown(object sender, TouchEventArgs e)
{
//ScatterView sv = new ScatterView();
//ScatterViewItem vi = new ScatterViewItem();
//sv.Items.Add(vi);
//vi.SetResourceReference(DependencyProperty.Register("",Type.DefaultBinder,type
//sv.Items.Add(new UserControl1());
UserControl1 user_keyboard = new UserControl1();
user_keyboard.Name = "user1";
user_keyboard.Visibility = System.Windows.Visibility.Hidden;
if (user_keyboard.Visibility != Visibility)
{
ScatterViewItem svi = new ScatterViewItem();
svi.Height = 340;
svi.Width = 1000;
user_keyboard.Visibility = System.Windows.Visibility.Visible;
svi.Content = user_keyboard;
sv.Items.Add(svi);
}
}thanks
i just want to show only one time but int this code i have no idea how to track my custom control that show by this textbox or not
Dharmesh Sharma info@dharmeshsharma.com www.dharmeshsharma.com
-
Tuesday, May 01, 2012 10:34 AM
Hello,
The following code should do the trick.
private void AddressBoxBrowserNumber01_TouchDown(object sender, TouchEventArgs e) { if (sv.Items.OfType<ScatterViewItem>().Count(i => i.Name.StartsWith("Keyboard")) == 0) { UserControl1 user_keyboard = new UserControl1(); user_keyboard.Name = "user1"; ScatterViewItem svi = new ScatterViewItem(); svi.Height = 340; svi.Width = 1000; svi.Name = "Keyboard"; user_keyboard.Visibility = System.Windows.Visibility.Visible; svi.Content = user_keyboard; sv.Items.Add(svi); } }I hope this helps you.
Roy Janssen - Semper IT Services (Please mark an answer as "answered" if it does help you!)
- Proposed As Answer by Roy Janssen - Semper IT Services Tuesday, May 01, 2012 10:40 AM
-
Tuesday, May 01, 2012 11:08 AM
Hello, Roy Janssen
But i m trying this same code with two textboxs then not working
its only work for one so every textbox generate unique custom contol show how i mean how to create a unique name of contol when every
text box show control
Dharmesh Sharma info@dharmeshsharma.com www.dharmeshsharma.com
-
Tuesday, May 01, 2012 12:26 PM
Hello,
Based on the information you gave until now the previous answer was correct. We can not know what you want if you do not specify it.
If you take a close look at the provided code you can simply change this to your needs...private void AddressBoxBrowserNumber01_TouchDown(object sender, TouchEventArgs e) { TextBoxTouched("user1"); } private void AddressBoxBrowserNumber02_TouchDown(object sender, TouchEventArgs e) { TextBoxTouched("user2"); } private void TextBoxTouched(string textBoxName) { if (sv.Items.OfType<ScatterViewItem>().Count(i => i.Name.StartsWith(textBoxName)) == 0) { UserControl1 user_keyboard = new UserControl1(); user_keyboard.Name = "user1"; ScatterViewItem svi = new ScatterViewItem(); svi.Height = 340; svi.Width = 1000; svi.Name = textBoxName; user_keyboard.Visibility = System.Windows.Visibility.Visible; svi.Content = user_keyboard; sv.Items.Add(svi); } }Hope this helps.Roy Janssen - Semper IT Services (Please mark an answer as "answered" if it does help you!)
- Proposed As Answer by Roy Janssen - Semper IT Services Tuesday, May 01, 2012 12:28 PM
-
Tuesday, May 01, 2012 12:39 PM
yes i m sorry i m not provide correct information
baiscly i m doing i am add dyamicly add textbox to main window form every textbox touch event i genrate a keyboard
thats its
but now problem is where i add ScatterView in main window then my Custom control textbox how i show keyboard like this
if (sv.Items.OfType<ScatterViewItem>().Count(i => i.Name.StartsWith(textBoxName)) == 0) { UserControl1 user_keyboard = new UserControl1(); user_keyboard.Name = "user1"; ScatterViewItem svi = new ScatterViewItem(); svi.Height = 340; svi.Width = 1000; svi.Name = textBoxName; user_keyboard.Visibility = System.Windows.Visibility.Visible; svi.Content = user_keyboard; sv.Items.Add(svi); }
cos we can add only one ScatterView ?
Dharmesh Sharma info@dharmeshsharma.com www.dharmeshsharma.com
-
Tuesday, May 01, 2012 12:42 PM
what i am doing
i have main form . Now i have created two custom controls one textbox and keyboard
first i have add textbox by programming when user touch any one textboxs i have to show keyboard contols
so my flow is disturb i don't understand how i do this flow in wpf
thanks
Dharmesh Sharma info@dharmeshsharma.com www.dharmeshsharma.com
-
Tuesday, May 01, 2012 12:48 PM
Hello,
I do not understand your question. You only need one ScatterView in the provided example it is called "sv"
By selecting the textboxes you add a ScatterViewItem to the ScatterView. You keep adding ScatterViewItem objects to the ScatterView, this is the way to do it. If you need more ScatterView's you could change the code to not only give the textboxname but also the ScatterView to which the ScatterViewItem needs to be added.
I hope this answers your question.
Roy Janssen - Semper IT Services (Please mark an answer as "answered" if it does help you!)
-
Tuesday, May 01, 2012 12:56 PM
Yes sir this is my answer
i m posting new question with more info
thanks
Dharmesh Sharma info@dharmeshsharma.com www.dharmeshsharma.com
-
Tuesday, May 01, 2012 1:06 PM
Is your problem solved? Dont forget to mark an answer as "answered".
Roy Janssen - Semper IT Services (Please mark an answer as "answered" if it does help you!)
- Edited by Roy Janssen - Semper IT Services Friday, May 04, 2012 5:58 AM

