imasm / wpfkb Goto Github PK
View Code? Open in Web Editor NEWWPF Touch Screen Keyboard
License: MIT License
WPF Touch Screen Keyboard
License: MIT License
@imasm could you Please update WPFKB to latest DotNet, Thank You.
There are times I want the keyboard to open, and other times I want it to not open. Could you please tell me, how could I do that with wpfkb?
Originally, this is what I used to get the keyboard to be present:
<keyboard:FloatingTouchScreenKeyboard
x:Name="Keyboard"
IsOpen="True"
Width="1215"
Height="600"
VerticalOffset="200"
PlacementTarget="{Binding ElementName=LoginView}"
Placement="Center"
AreAnimationsEnabled="True"
/>
Presently, this is what I have on pages I want to use the keyboard (see How can I access a control in mvvm model ):
public class InspectionCommentViewModel : NotificationStepViewModel
{
public IInspectionConfirmationView InspectionConfirmationView { get; set; }
public override void OnNavigatingTo()
{
if(HasNotification) _currentText = NotificationComment;
if (!_inspection.IsCompleted)
{
IsOpen = true;
}
// The problem is that this view is always null, so I can never show the keyboard
if (InspectionConfirmationView == null) return;
{
InspectionConfirmationView.ShowFloatingKeyboard();
}
}
}
public partial class InspectionComment : UserControl, IInspectionConfirmationView
{
private FloatingTouchScreenKeyboard _floatingTouchScreenKeyboard;
public InspectionComment()
{
InitializeComponent();
// The problem is that this DataContext is null, and if I create an instance here it is not the same instance of the InspectionCommentViewModel that gets called elsewhere in the app
if (DataContext == null)
{
DataContext = ServiceLocator.Current.GetInstance<InspectionCommentViewModel>();
}
// access you VM by strategy of your framework or choice - this example is when you store your VM in View's DataContext
(DataContext as InspectionCommentViewModel).InspectionConfirmationView = this as IInspectionConfirmationView;
}
public void ShowFloatingKeyboard()
{
_floatingTouchScreenKeyboard =
new FloatingTouchScreenKeyboard()
{
IsOpen = true,
Width = 1215,
Height = 540,
Placement = PlacementMode.Center,
VerticalOffset = 200,
AreAnimationsEnabled = true
};
Binding myBinding =
new Binding
{
ElementName = "InspectionCommentView",
Source = _floatingTouchScreenKeyboard,
Path = new PropertyPath("PlacementTarget")
};
// Attach to a target property
this.SetBinding(FloatingTouchScreenKeyboard.PlacementTargetProperty, myBinding);
}
}
So far, I have been trying to follow this pattern to get access to open the keyboard a view, but the problem is that my DataContext is null in the constructor. Is there any way I can get this working without using Caliburn.Micro? The only way I can see how to do it would be to use Caliburn.Micro and call OnViewAttached.
Basically, what I want is to be able to open and close the keyboard from the viewmodel instead of just having it set to open all the time in the XAML. Any suggestions?
WpfKb is effectively obsolete. It is based upon System.Windows.Interativity. This has been abandoned by Microsoft and no longer has any type of support. An effort was made to replace it by Microsoft.Xaml.Behaviors.Wpf (https://github.com/microsoft/XamlBehaviorsWpf) This effort has flounder due to lack of interest on Microsoft's part (PrismLibrary/Prism#1804)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.