Note that there are some explanatory texts on larger screens.

plurals
  1. POcolor in xaml from c#(windows phone)
    primarykey
    data
    text
    <p>XAML:</p> <pre><code>&lt;Rectangle Fill="{Binding Gray}" /&gt; </code></pre> <p>C#:</p> <pre><code>public class colors { public string Gray { set {} get{ return "#FF22262a";} } } </code></pre> <p>There is no error when I compile. But rectangle does not fill in "#FF22262a"</p> <p>EDIT: This code does not work too:<br> MainPage.xaml</p> <pre><code>&lt;TextBlock Text="{Binding MyGray2}"&gt;&lt;/TextBlock&gt; </code></pre> <p>MainPage.xaml.cs</p> <pre><code>public String MyGray2 { set { } get { return "gjnuegheugheog"; } } </code></pre> <p>EDIT2:</p> <pre><code>&lt;phone:PhoneApplicationPage x:Class="FlagLib.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:FlagLib" 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" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True"&gt; &lt;phone:PhoneApplicationPage.Resources&gt; &lt;vm:colors x:Key="vmColors" /&gt; ... &lt;/phone:PhoneApplicationPage.Resources&gt; ... &lt;Grid Grid.Column="0" Tap="onToggleHorizontal" DataContext="{StaticResource vmColors}"&gt; &lt;Rectangle Fill="{Binding Gray}" /&gt; ... </code></pre> <p>EDIT3:<br> MainPage.xaml:</p> <pre><code>&lt;phone:PhoneApplicationPage x:Class="proba5.MainPage" 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:vm="clr-namespace:proba5" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True"&gt; &lt;phone:PhoneApplicationPage.Resources&gt; &lt;vm:colors x:Key="vmColors"/&gt; &lt;/phone:PhoneApplicationPage.Resources&gt; &lt;Grid x:Name="LayoutRoot" Background="Transparent"&gt; &lt;Grid DataContext="{StaticResource vmColors}"&gt; &lt;Rectangle Fill="{Binding Gray}" /&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/phone:PhoneApplicationPage&gt; </code></pre> <p>colors.cs</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace proba5 { public class colors { public string Gray { set { } get { return "#FF22262a"; } } } } </code></pre> <p>Why i got <strong>The name "colors" does not exist in the namespace "clr-namespace:proba5".</strong> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload