xaml design doesnot work - visual-studio-2012

i can't see any control in xaml designer , i can click on them and go to behind code but can't see then , i reinstall VS 2012 but no luck , even if i create new project it will do the same , and this happen with blend too . i searched so so so so much to solve this problem , but no luck , please help me
PS : i installed vs 2010 sp1 , vs 2012 update 1
here the basic code of blank windows store app with a button
<Page
x:Class="App6.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App6"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
</Grid>
</Page>

AT LAST after 5 days searching . i found the problem , it was from my video card :
i have hp probook 4540s laptop , it has intel and amd video cards ,so i customize the setting to give me full graphics power , so i open Catalyst Control Center and made the Power give me Maximize Performance (and here the problem started) i changed it to Optimize Performance and all came back to normal (OMG)

This is a guess, but you normally have to give the grid some kind of row or column definition. Here is a grid that defines two rows:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Content="hello world"></Button>
</Grid>
The above works for me, but the following does NOT work:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Button Content="hello world"></Button>
</Grid>

Related

Catel wraps usercontrol content in viewmodel grid even when naming content grid "__catelInnerWrapper"

I'm having a problem creating a viewmodel grid manually in Catel for a Catel usercontrol. The documentation implies that by naming the content grid "__catelInnerWrapper" that the content will not be wrapped with another grid by the ViewModelWrapperService and will use my grid instead. I'd like to do so for visual state management purposes. Using Snoopwpf I can see that the usercontrol is still being wrapped.
(https://i.imgur.com/teSu9La.png)
I tried creating a new Catel project template using Catel 5.8.0 and also 5.9.0 beta 0 using .NET 4.6.1 with a single usercontrol in the mainwindow to test a simplified application and saw the same behavior.
<catel:UserControl x:Class="CatelTest.Views.MyUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:catel="http://schemas.catelproject.com">
<Grid x:Name="__catelInnerWrapper">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="{Binding Title}" />
<Label Grid.Row="1" Content="My User Control" />
</Grid>
</catel:UserControl>
In stepping through ViewModelWrappingService.xaml.cs code it seems the usercontrol content Name property is always resolving to null and thus isn't matched with the InnerWrapperName. Do you know why this might be happening? Thank you
When looking at the source, you are doing the correct thing. If you are 100% sure that:
You are using a correct build (e.g. fully rebuilt app, not a
wrong configuration)
Snoop is correct
Then please report an issue (with minimal repro) at https://github.com/catel/catel/ and we will make sure it will be fixed in Catel 5.9 (currently in beta, about to be released but we will wait for this one).

The button is not visible

I have a UWP application, I have added a button but when I debug the application, I can't see the button. If I add a texblock or textBox I can see them, but not the button.
I have set IsEnabled to true and visibility to visible but I am not able to solve the problem.
Also I have tried to click in the place where it should be the button but nothing happens.
This happens when I debug in local machine and when I debug in a emulator of windows phone 10.
Thank you so much.
EDIT: the axml code
<Page
x:Class="SqliteEF7UWP.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SqliteEF7UWP"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="Transparent">
<Button x:Name="GetVideos" IsEnabled="True" Visibility="Visible" Background="Aquamarine" Content="Buscar Videos" HorizontalAlignment="Left" Margin="120,98,0,510" VerticalAlignment="Stretch" Click="button_Click"/>
<TextBlock x:Name="textBlock" Foreground="BlueViolet" HorizontalAlignment="Left" Margin="101,59,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="34" Width="132"/>
<TextBox x:Name="textBox" HorizontalAlignment="Left" Margin="213,59,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top"/>
</Grid>
</Page>
The margin you set for the Button is too aggressive. The object is now "squeezed". For example set Margin to "120,98,0,200" (or simply "120,98") instead of "120,98,0,510" and it should be visible.
BTW using hardcoded margins to setup the user interface is probably not a good idea. Use for example the Grid with columns and rows instead of margins.

Adding MapControl in xaml results in a "Catastropic failure"

I am creating an universal application using Visual Studio Ultimate 2013 Version 12.0.30501.00 Update 2. I am getting Catastrophic failure on adding Map Control in my xaml like this
<Maps:MapControl Visibility="Collapsed"/>.
I have added
xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps"
in the page header and added 'location' capability to application manifest file.
Has anyone faced the same issue?
You can test his by creating a sample application and add only MapControl. Please help me to resolve this issue.
The problem is observed in normal Windows Phone 8.1 applications also. Am i missing something here?
The problem is observed when i try to run the application in emulator.
The error does not show any other information just 'catastropic failure', nothing else.
May be i will try to re-install Visual Studio. But one more interesting fact is that i could get it working if i am not hiding the map control in the page.
Can you test it by creating a sample application and just making the map control Visibility='Collapsed'?
<Page
x:Class="TestMaps.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TestMaps"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Maps:MapControl Visibility="Collapsed" />
</Grid>
</Page>
And the problem is observed in more than one PC.
I've tested your example and indeed there is such a problem also on my Phone.
As I have checked it is possible to set Collapsed from code - so as a workaround:
<Grid>
<Maps:MapControl Name="myMap" Visibility="Visible" />
</Grid>
In the code behind:
public MainPage()
{
this.InitializeComponent();
this.Loaded += (sender, e) => myMap.Visibility = Visibility.Collapsed;
}
I've come up with a workaround for this. Instead of using visibility you can use the maps height/width properties to hide/show the map. Set them to 0 when you want to hide it, and set it to the parents width/height when you want to show it. Here is a code sample:
<Page
x:Class="WP81App.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WP81App"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Maps:MapControl Name="MyMap" Height="0" Width="0" />
<Button Content="Show Map" Click="ShowMapBtn_Clicked" HorizontalAlignment="Center"/>
</Grid>
</Page>
Button Handler:
private void ShowMapBtn_Clicked(object sender, RoutedEventArgs e)
{
var mapContainer = MyMap.Parent as FrameworkElement;
MyMap.Width = mapContainer.ActualWidth;
MyMap.Height = mapContainer.ActualHeight;
//Hide the button
(sender as Button).Visibility = Visibility.Collapsed;
}

Wide Windows phone? What view is this?

I fat fingered something when hitting debug and now I am stuck in this view.
Ive never seen it before, have no idea how I did it and would LOVE to know how to undo it.
Mind you this is a Windows Phone 8 app.
<phone:PhoneApplicationPage
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"
xmlns:UI="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
x:Class="mycuts.MainPage"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar>
<shell:ApplicationBarIconButton x:Name="add" Text="add" IconUri="/images/add.png"/>
<shell:ApplicationBarIconButton x:Name="del" Text="delete" IconUri="/images/minus.png"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="RT APPS" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
<TextBlock Text="My Cuts" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<Grid x:Name="ContentPanel" Margin="0,161,0,0">
<StackPanel Orientation="Vertical">
<ListBox x:Name="cutsList" Height="451"/>
<!--<UI:AdControl ApplicationId="test_client" AdUnitId="Image480_80" HorizontalAlignment="Left" Height="80" VerticalAlignment="Top" Width="480"/>-->
</StackPanel>
</Grid>
</Grid>
</phone:PhoneApplicationPage>
Sometimes the Blend or Visual Studio 2012/2013 Designer can go wacky like that. You can do one of two things:
Close and Reopen the XAML page
Shut down and reopen Visual Studio
Usually the first option fixes it for me, but the second one always does.
Happy coding!

Androids RelativeLayout for Windows Phone

I'm currently trying to design a table for contact information including a column for icons like telephone, email or similar symbols and I want to align them with the text from the next column
icon | Telephone:
| +1212354567
icon | Email:
| x#y.com
Is there any Layout which can be compared in functionality to Androids RelativeLayout? I tried to work with the Grid Layout but this seems to be error prone and not exact enough. I don't want to divide my layout into columns and rows, instead I want to describe their position as it is used in RelativeLayout (toLeft, toRight, AlignParentBottom etc.).
The StackPanel can be compared to the LinearLayout, which I want to avoid as it is not suitable for my current design.
Is there any comparison between Windows Phone and Android Layouts on which I can orientate? This one is incomplete and does not give advise for the RelativeLayout.
I know you said you did not want to use a Grid but I feel that you have to in this case.
I would structure it with both a grid and stack panels though.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<!-- Image for first row item -->
<Image Grid.Column="0" Grid.Row="0" Source="icon-url" />
<!-- Container for the details of the first row item -->
<StackPanel Grid.Column="1" Grid.Row="0">
<TextBlock Text="Telephone:" />
<TextBlock Text="+1212354567" />
</StackPanel>
<!-- Image for second row item -->
<Image Grid.Column="0" Grid.Row="1" Source="icon-url" />
<!-- Container for the details of the second row item -->
<StackPanel Grid.Column="1" Grid.Row="1">
<TextBlock Text="Email:" />
<TextBlock Text="x#y.com" />
</StackPanel>
<!-- Just add rows to the grid to continue the list -->
</Grid>
There is no panel that compares, but someone that was adventurous could create one. There are many articles on how to do this, but here's one for reference. http://www.switchonthecode.com/tutorials/wpf-tutorial-creating-a-custom-panel-control
That said, there's no reason not to use Grid for what you're trying to do. It's not "error prone" or "not exact enough". SharedSizeGroup should become your friend here, though.

Resources