WPF application lost touch capabilities - wpf

I'm developing a WPF application with VB2010 and expression blend4.
This application is mainly intended to be used through touch user input.
I don't know when and why but all UI_ELEMENTs have lost default touch responsiveness, for example the button click event doesn't rise anymore the click event when touched, the Slider element doesn't slide, and so on.
I'm using framework 4.0
I post the xaml header:
<Window
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:my1="clr-namespace:WpfApplication1" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:ee="http://schemas.microsoft.com/expression/2010/effects" xmlns:DataStore="clr-namespace:WpfApplication1.Expression.Blend.DataStore.DataStore" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ec="http://schemas.microsoft.com/expression/2010/controls" xmlns:Microsoft_Samples_Kinect_WpfViewers="clr-namespace:Microsoft.Samples.Kinect.WpfViewers;assembly=Microsoft.Samples.Kinect.WpfViewers" xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" mc:Ignorable="d" x:Class="MainWindow"
Any help is welcome.

Related

Can MahApps.Metro be used in MvvmCross?

I was trying to use Mahapps Metro inside a WPF project using MvvmCross mvvm framework.
Both seem to use custom window control. Is there a way to use both in a project?
Metro window:
<mah:MetroWindow x:Class="TipCalc.WPF.MainWindow"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TipCalc.WPF"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
mc:Ignorable="d"
Title="MainWindow"
Height="450"
Width="800">
<Grid>
</Grid>
</mah:MetroWindow>
MvvmCross Window:
<views:MvxWindow x:Class="TipCalc.WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TipCalc.WPF"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
mc:Ignorable="d"
Title="MainWindow"
Height="450"
Width="800">
<Grid>
</Grid>
</views:MvxWindow>
The application runs either way. But with the Metro window in place, the rest of the application doesn't get set up(ie.-children views). With the MvvmCross window in place, the application works as usual but is not designed or colored.
Since multi inheritance is not supported in C#, this is not possible out of the box.
But a look at the source code of MvxWindow shows it's no big class. So a potential solution could be creation of your own window. This window, let's call it MvxMetroWindow, could collect both functionalities by inheriting from MetroWindow and aditionally all the source code of MvxWindow added (copied from the original source code) by yourself.
This would look like this:
using System;
using System.Windows;
using MahApps.Metro.Controls;
using MvvmCross;
using MvvmCross.Binding.BindingContext;
using MvvmCross.Platforms.Wpf.Views;
using MvvmCross.ViewModels;
using MvxApplication = MvvmCross.Platforms.Wpf.Views.MvxApplication;
namespace TipCalc.WPF
{
public class MvxMetroWindow : MetroWindow, IMvxWindow, IMvxWpfView, IDisposable
{
private IMvxViewModel _viewModel;
private IMvxBindingContext _bindingContext;
private bool _unloaded = false;
//... Further implemenetation of original MvxWindow
}
}
The custom window finally can be used like this:
<local:MvxMetroWindow x:Class="TipCalc.WPF.MainWindow"
xmlns:local="clr-namespace:TipCalc.WPF"
...

navigation window in maximizes screen

i have to Give navigation in my application so i took one navigation window and other as page object.i provided windowstate="maximized" still it dont open in full screen.can anyone help me?
NavigationWindow
<NavigationWindow x:Class="SALIENT.View.Start"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Start" Source="../View/MainWindow" WindowState="Maximized">
Page
<Page x:Class="SALIENT.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Salient" >
If you want a full screen you need to set your "WindowStyle" property to none, try this:
<NavigationWindow x:Class="SALIENT.View.Start"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Start" Source="../View/MainWindow" WindowState="Maximized" WindowStyle="None>

Strange strip at the top of Windows 10 (wpf)

I have this xaml on a project that uses Caliburn micro :
<Window x:Class="Myproject.MainWindowView"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="1024" WindowStyle="None" Background="Black" >
</Window>
but when I run the application, I have a white line at the top of window :
How can I remove the line at the top?
I need a window that has no title bar, but should be resizable.
Well for the sake of easy points I suppose, the window chrome is built into the style templates and still inherited when you define WindowStyle="None" but still allow re-sizing to allow a hit spot for the manipulation event to occur. So like described in another answer you can take control of the base template and edit it to your requirements while still retaining the ability for the user to have point to invoke the re-sizing ability but with the frame thickness set to 0.
Hope this helps, cheers!

Create Design Time Data in WPF

My MainWindow.xaml loads very slowly, so I'm trying to create a design-time data for that. I have checked some websites on the net and tried to create design-time data but it gives error.
Here is my part of xaml, the rest is wpf elements :
<Window x:Class="CodeFirstMVVM.App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cm="clr-namespace:System.ComponentModel;assembly=System"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:CodeFirstMVVM.App.ViewModels"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:CodeFirstMVVM.App.ViewModels"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=model:Ogrenci, IsDesignTimeCreatable=True}"
DataContext="{Binding Source={StaticResource Locator}, Path=OgrenciView}"
Title="MainWindow" Height="500" Width="900">
I get the error in this line :
d:DataContext="{d:DesignInstance Type=model:Ogrenci, IsDesignTimeCreatable=True}"
And the errors are :
Error 1 The namespace prefix "model" is not defined.
Error 2 Ogrenci is not supported in a Windows Presentation Foundation (WPF)
The DesignTimeViewModel is under CodeFirstMVVM.App, and it is simply an empty class with an empty constructor. Can you tell me how to create a design time data in a healthy way? I'm really stuck with this.

How to use Ignorable="d"

I want to make my usercontrol with yellow background while designing. After design it should stay transparent.
I've tried to use the "Ignore" flag but could not catch how it works.
<UserControl x:Class="Abnehmen_Standard.ucRoundButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="84" d:DesignWidth="84"
d:Background="Yellow"
Last row does not work.
Can you advice me?
This will work if you are using Expression blend. As you can see in your mark up
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
"d" is used only for expression blend not for visual studio.
Look at this article if you want to do the same for visual studio, you will have to do some coding for this.

Resources