- Welcome, Guest. Please Login or Register
MindFusion  
  MindFusion Xamarin Pack beta version includes diagram, chart and calendar controls for Xamarin.Forms. Now beta testing Chart and Gauge components for Java Swing.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Can I set the template and style in xaml instead of code behind
Read 193 times

Dan Neely   Offline
YaBB Newbies
*
Posts: 3
I Love MindFusion!


   
     
 
Can I set the template and style in xaml instead of code behind
Dec 19th, 2016 at 7:06pm
 
Your example code all shows these being set in code behind; which means that the UI designer always shows your default layout instead of the layout I'm using.

ex from StyleSamples.cs in your example projects:

Code (C++):
virtualKeyboard.TemplateLayout = KeyboardLayout.Create(
                    this.GetType().Assembly.GetManifestResourceStream("Styles.CustomLayout.xml"));
//set custom style of VirtualKeyboardStyle from file
resources.Source = new Uri("/Styles;component/VirtualKeyboardWithImages.xaml", UriKind.Relative);
this.Resources.MergedDictionaries.Add(resources);
 



 
 
 
IP Logged    
 
     

Slavcho   Offline
YaBB Moderator
*****
Posts: 750
Gender: male
tech.support


   
     
 
Re: Can I set the template and style in xaml instead of code behind
Reply #1 - Dec 20th, 2016 at 4:08pm
 
You can define keyboard layout from Xaml like this -
Code:
<vk:VirtualKeyboard>
	<vk:VirtualKeyboard.TemplateLayout>
		<vk:KeyboardLayout>
			<vk:KeyboardLayout.Keys>
				<vk:RegularKey Content="A" Left="10" Top="10" Width="60" Height="60" />
				<vk:RegularKey Content="B" Left="80" Top="10" Width="60" Height="60" />
				...
			</vk:KeyboardLayout.Keys>
		</vk:KeyboardLayout>
	</vk:VirtualKeyboard.TemplateLayout>
</vk:VirtualKeyboard> 



Seeing an external layout file created using the Keyboard Creator tool in VS design time should be possible too - try creating an IValueConverter that returns KeyboardLayout.Create(filename) from Convert method and use it in TemplateLayout binding expression.

Regards,
Slavcho
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print