Microsoft.Phone.Shell.dll is missing? - windows-phone-7

i just start developping windows phone apps through using silverlight & windows phone SDK 7.1 frameworks and while i am open a new project for developping an App[lication] bar i noticed that i need a reference [Microsoft.Phone.Shell] well .. i try to add it .. after a multiple of effort of searching i see that i didn't have the .Dll file → [Microsoft.Phone.Shell.dll] in the directory of my installed .Dll files .. so Plz my friends i need an answer or a hint to complete that app ....

What you need to do to be able to use Application Bar are:
Add reference to Microsoft.Phone.dll
Add following two namespaces
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
Then you can use the application bar :
<phone:PhoneApplicationPage
...
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
...
>
...
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True">
<shell:ApplicationBarIconButton IconUri="/Images/button1.png" Text="Button 1"/>
<shell:ApplicationBarIconButton IconUri="/Images/button2.png" Text="Button 2"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

Related

Overwrite Resources in Windows 10

I have the following simplified scenario:
A Windows 10 Class Library containing a UserControl with an Image Control that displays an image from a file inside the library:
<Image Source="Assets/myimage.png"></Image>
Now I have different App-Projects (UWP) containing this library and displaying my Image Control.
In these Projects are different images that should replace the original myimage.png. Simply putting the new image in Assets Folder of my App-Project does not work (thats the way it works in Android).
Summary: I want to replace a Image-File in a Library with a file in my actual App-Project.
Edit:
The Control inside the Library:
<UserControl
x:Class="mLib.TestImageView"
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">
<Grid>
<Image x:Name="Image" Source="Assets/myimage.png"></Image>
</Grid>
Usage Inside the App:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<mlibrary:TestImageView/>
</Grid>
Put slash in the beginning, like this:
<Image x:Name="Image" Source="/Assets/myimage.png"></Image>
Replacing will work fine then. But I don't think you'll be able to use original image in referencing projects after that.

Transitions (i.e. EntranceThemeTransition) doesn't work in UWP

I am trying to apply EntranceThemeTransition on a button but it doesn't seem to work. I didn't get any error and the app runs fine but without the transitions.
Here's my code:
<Page
x:Class="App9.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App9"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button Content="Hello World" Click="Button_Click">
<Button.Transitions>
<TransitionCollection>
<EntranceThemeTransition FromHorizontalOffset="100" IsStaggeringEnabled="True"/>
</TransitionCollection>
</Button.Transitions>
</Button>
</Grid>
</Page>
I already tried this and this. But it still doesnt work.
Update: The following code works on my home PC. I tried to reset all the settings in VS2015 and still didn't work. It looks like there's something that messed up my environment. I need help from anyone who encountered the same problem.
Alright, I know the answer. It's not Visual Studio, it's in the System Settings. I went to System Settings.
Win + X
click System
click Advanced System Settings
On the Advanced tab, go to performance section then click Settings
Check "Animate controls and elements inside windows"
Click Apply button.

Use StaticResources in Class Library on Windows 8.1

I want to create a class library for my Windows 8.1 project, which includes all the views for my app. So I've created the project, but Visual Studio told me that it is not possible to access the StaticResources.
<StackPanel>
<TextBlock
Text="123"
Style="{StaticResource HeaderTextBlockStyle}" />
<TextBlock"
Text="456"
Style="{StaticResource HeaderTextBlockStyle}" />
</StackPanel>
For example 'HeaderTextBlockStyle' was marked in blue and it told me that the resource 'HeaderTextBlockStyle' could not be found. So I can't see my page in the designer, because of the issue.
I can run my app without problems, but how can I get access to the StaticResources?
In Windows 8.1 some things have changed, including the inclusion of the StandarStyles.xaml (it's no longer included explicitly). This guide is very helpful to make the transition: http://blogs.windows.com/windows/b/appbuilder/archive/2013/07/24/windows-8-to-windows-8-1-preview-starting-with-the-xaml-templates.aspx
For your specific problem I recommend you to try:
Style="{ThemeResource HeaderTextBlockStyle}"

Windows phone ads not working

I am trying to integrate ads into a already successful deployed app. However no matter what I do, I cannot seem to get the ads working. I have tried using both the code version and the drag n' drop gui version. Neither of which I can get to work.
This is what I see: When it starts up it may flash for a split second white, where the ad is supposed to be, but none the less, no adds. It recognizes that it is where I place it, when I place it over a button, the button becomes unclickable. All being said, no default "microsoft advertising" image pops up. I have installed the ad SDK and have successfully been able to make the ads display in other project with ease.
What gives? This is very simple page and I cannot figure out what is wrong. It also seems that I cannot place an ad on any of the other pages either... I do have the Microsoft.Advertising.Mobile and Microsoft.Advertising. Mobile.UI included in the project and my internet is working (I have an project open at the same time with ads and it works)
<phone:PhoneApplicationPage
x:Class="AppName.AdPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
shell:SystemTray.IsVisible="True"
xmlns:my="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Margin="12,17,12,28">
<TextBlock x:Name="PageTitle" Text="Thank You!" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" Width="334" />
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0" Height="569" VerticalAlignment="Top">
<Button Content="Ok" Height="72" HorizontalAlignment="Center" Margin="0,428,0,0" Name="button1" VerticalAlignment="Top" Width="160" Click="button1_Click" />
<my:AdControl AdUnitId="Image480_80" ApplicationId="test_client" Height="80" HorizontalAlignment="Left" Margin="-12,458,0,0" Name="adControl1" VerticalAlignment="Top" Width="480" />
</Grid>
</Grid>
</phone:PhoneApplicationPage>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Advertising.Mobile.UI;
using Microsoft.Advertising.Mobile;
namespace Stickey_Note_v._1
{
public partial class AdPage : PhoneApplicationPage
{
public AdPage()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
}
}
}
I had the same issue and wrote a blog post about it. Here's the important stuff:
The symptoms of a problem with the SDK's AdControl seem to be pretty consistent: The page loads, the control flickers briefly, showing the hint of a 1 pixel frame, and then, poof. It collapses into nothingness, leaving only a black hole of dispair.
In theory, setting up the AdControl is simple. The documentation from Microsoft outlines the basics:
Download and install the Microsoft Advertising SDK.
Add a reference to Microsoft.Advertising.Mobile.UI.
Drag the control onto the page in the Visual Studio designer.
Set the AdUnitId and ApplicationId properties to either test values or actual live values, which you can obtain from Microsoft pubCenter.
But it couldn't be that easy. I followed the documentation carefully, but nothing was working. I couldn't even get test ads to show up, which seemed really weird. I even reverted to an older version of my app (yay source control!) and dropped in the new .dll. Failure.
Finally, I found a clue in an obscure forum post.
The Microsoft documentation neglects to mention several important details. You need to pay particular attention to the following if you're upgrading an existing project to the Mango ad SDK, as I was:
You must specify a height and width for the AdControl. Failing to specify the Height and Width attributes, or setting them to auto, will cause tears of frustration. I'd recommend 80 pixels high and 480 pixels wide, as that's the native size of the ads that Microsoft serves up.
It seems that you can't have two AdControls on the same page, or at least not in the same parent element. The second one will collapse. There might be a way around this, but I discovered it while building my demo app and didn't care to pursue a solution.
You must must must specify certain capabilities in your WMAppManifest.xml file. Since I was upgrading my app, I didn't have some of the newer capabilities declared. The one that was causing all the trouble was ID_CAP_IDENTITY_USER. The following capabilities are all required for the control to function correctly:
<Capabilities>
<Capability Name="ID_CAP_IDENTITY_USER"/>
<Capability Name="ID_CAP_MEDIALIB"/>
<Capability Name="ID_CAP_NETWORKING"/>
<Capability Name="ID_CAP_PHONEDIALER"/>
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
</Capabilities>
Hope that helps!
I think your problem could come from (if you didn't remove it for posting it here):
<my:AdControl AdUnitId="Image480_80" ApplicationId="test_client" Height="80" HorizontalAlignment="Left" Margin="-12,458,0,0" Name="adControl1" VerticalAlignment="Top" Width="480" />
</Grid>
You have to use AdUnitId and ApplicationId which you get from pubCenter.
One more think to note for those still struggling
xmlns:ads="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
<ads:AdControl Height="80"
Width="480"
AdUnitId="Image480_80"
ApplicationId="test_client" />
As in example. Declaring ads and the namespace is super important.
In my project i just inserted the adcontrol part alt + enter for resharper to do the rest of the work which he didnt. He replaces ads with UI and there was no error compilation still the ads wouldn't show. When i declared ads myself and changed the adcontrol namespace. Everything worked fine.

WP71 MVVMLight EventTrigger not recognised

Having followed Laurent's upgrade guide http://www.galasoft.ch/mvvm/installing/mangobeta/ to get from an existing MVVMLight WP7 project to a WP71 project. I have changed the references and namespaces corectly. But the EventTrigger is not recognised in the XAML
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<cmd:EventToCommand
Command="{Binding Mode=OneWay, Path=LoadedCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
I get an error on the EventTrigger element.
Has it changed?
I had this exact same problem when I upgrade my application from WP7 to WP7.1(Mango). The problem was the MVVM Light Binaries. You need to upgrade to the WP7.1 Binaries.
Laurent Bugnion ( https://stackoverflow.com/users/12233/lbugnion ) explains how to upgrade the MVVM Light binaries on his website here: http://www.galasoft.ch/mvvm/installing/mangobeta/
These are the essential steps I used to fix my problem:
Download the most recent version from here.
Open and Compile the WP71 project.
Copy the binaries to your MVVM Binary location (in my case C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries)
Open your project
In the References folder, delete GalaSoft.MvvmLight, GalaSoft.MvvmLight.Extras and System.Windows.Interactivity.
Add the new references from the folder C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\WP71.
I had a similar problem after upgrading to Mango. In my case, I had the EventToCommand binding on a MenuItem click, but you seem to have it on some sort of loaded event. You could try using an anonymous delegate in the loaded evcent from the view's code-bhind. Ie:
this.Loaded+=(s,e)=>ViewModel.LoadedCommand.Execute(null);
In my case, I changed from:
<tk:MenuItem Header="Delete Snapshot" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<mvvmLight:EventToCommand Command="{Binding DeleteSnapshotCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem,ElementName=lstSnapshots}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</tk:MenuItem>
to
<tk:MenuItem Header="Delete Snapshot" Command="{Binding DeleteSnapshotCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem,ElementName=lstSnapshots}" />
I have moved on from this issue, by reverting back to pre-mango dev environment.
Not the solution I wanted, but - onwards and forwards.

Resources