How to set map's language - xaml

How can I set language on the Bing maps?
Here is my XAML:
<Maps:Map Credentials="key"
Language="ru" Grid.Row="1"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
ZoomLevel = "7.5">
I was trying Language parameter, but the language didn't change.

You have to use the Culture parameter, not the Language parameter. This is documented here: http://msdn.microsoft.com/en-us/library/dn306047.aspx
Try the following:
<Maps:Map Credentials="key"
Culture="ru" Grid.Row="1"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
ZoomLevel = "7.5">

Related

RadCombobox does not show correct property value

I'm unable to "clear" the current selection from a RadCombobox when needed. This RadCombobox is rebound with new data depending on the value of another radcombobox. After the rebinding, the prior selection should be cleared out. But it still displays. If the prior selection was "OAK", then the combobox still shows OAK as a selection when it should be blank. I find radcomboboxes very tricky to set up so I'm sure it's something dumb on my part.
The Text property of the combobox is bound to woodSpecies which is set up below:
<telerik:RadComboBox x:Name="cboWoodSpecies"
FontSize="16" Background="#F6F8FA" BorderBrush="#D7D8DD"
ItemsSource="{Binding}"
SelectedValue="theWoodSpecies"
Text="{Binding woodSpecies}"
telerik:TextSearch.TextPath="theWoodSpecies"
IsEditable="True"
Style="{DynamicResource RadComboBoxStyle3}" >
<telerik:RadComboBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding theWoodSpecies}"/>
<TextBlock Grid.Column="1" Text="{Binding WoodSpeciesUpchargeDisplay}"/>
<TextBlock Grid.Column="2" Text="{Binding WoodSpeciesUpcharge}" Visibility="Hidden"/>
</Grid>
</DataTemplate>
</telerik:RadComboBox.ItemTemplate>
</telerik:RadComboBox>
Private _woodSpecies As String
Public Property woodSpecies As String
Get
Return _woodSpecies
End Get
Set(value As String)
_woodSpecies = value
NotifyPropertyChanged("woodSpecies")
End Set
End Property
When it's time to clear the prior selection, this code is run:
thisOrder = New Order 'sets woodSpecies to empty string. Verified by debug.
cboWoodSpecies.SelectedIndex = -1 ' A debug break here shows that thisOrder.woodSpecies is empty string
The only way I can blank out the radcombobox is by using this code below. But I thought that was the whole point of INotifyPropertyChanged.
cboWoodSpecies.Text = String.Empty
How to fix this? Thanks.
I forgot to add Mode=TwoWay to Text="{Binding woodSpecies}"

How to fill an ellipse with different colors in Windows Phone 8.1 XAML?

am developing a WP8.1 app using xaml and C#.
i want to have a button or ellipse filled with multi colors like the below picture. How can i achieve this except using pie chart control?
I just need it in max height of 80 and width of 80
Can someone please help me out?
Thanks in advance
You use Arc shaped control to create this shape.
xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing"
<Grid>
<es:Arc ArcThickness="1" ArcThicknessUnit="Percent" EndAngle="360" Fill="#FF82ECDD" HorizontalAlignment="Left" Height="293" Margin="0,0,0,-100" Stretch="None" StartAngle="61" UseLayoutRounding="False" VerticalAlignment="Top" Width="294"/>
<es:Arc ArcThickness="1" ArcThicknessUnit="Percent" EndAngle="360" Fill="#FF38B5E4" HorizontalAlignment="Left" Height="293" Margin="0,0,0,-100" Stretch="None" StartAngle="298" UseLayoutRounding="False" VerticalAlignment="Top" Width="294" RenderTransformOrigin="0.5,0.5">
<es:Arc.RenderTransform>
<CompositeTransform Rotation="61.609"/>
</es:Arc.RenderTransform>
</es:Arc>
<es:Arc ArcThickness="1" ArcThicknessUnit="Percent" EndAngle="360" Fill="#FF349AD4" HorizontalAlignment="Left" Height="293" Margin="0,0,0,-100" Stretch="None" StartAngle="179" UseLayoutRounding="False" VerticalAlignment="Top" Width="294" RenderTransformOrigin="0.5,0.5">
<es:Arc.RenderTransform>
<CompositeTransform Rotation="-119.36"/>
</es:Arc.RenderTransform>
</es:Arc>
</Grid>
You can convert a single ellipse into path and then remove one point in the path to make it a semicircle.
Have three semicircle rotated at proper angle to achieve something similar to the image above.

UWP : Setting the Width and Height of controls as percentage values

I am trying to use a StackPanel control to display some overview options. I need to have this control using 20% of the window width when the MinWindowWidth is greater than 768px. When this is run on mobile I need the control to fill the width of the screen.
I tried as suggested in this question to try and set a value in percentage. However, I get the error - "* string cannot be converted to length".
Here is my XAML -
<StackPanel x:Name="OverviewStack">
<RelativePanel>
<StackPanel Margin="10" x:Name="User" Orientation="Horizontal">
<Ellipse Margin="5" Width="50" Height="50">
<Ellipse.Fill>
<ImageBrush>
<ImageBrush.ImageSource>
<BitmapImage UriSource="Assets/insp.jpg" />
</ImageBrush.ImageSource>
</ImageBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock Margin="5" VerticalAlignment="Center" Text="Ajay Kelkar" />
</StackPanel>
<StackPanel Margin="10" x:Name="Options" Orientation="Vertical">
<TextBlock Margin="5" Text="Sample text" />
</StackPanel>
</RelativePanel>
</StackPanel>
Is a percentage value not possible in UWP? Or am I doing something wrong?
You need to determine which platform you're currently on, and set the value accordingly.
This sounds like a converter.
Since you only have 1 project for UWP you'll need to check in the converter which platform you're on. such info can be acquired as such:
if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile")
{
//Act accordingly
}
So I think you'd like to do something like this:
public object Convert(object value, Type targetType, object parameter, string language)
{
// bind the width as the value the converter is set upon
var width = double.Parse(value.ToString());
if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile")
{
return width;
}
// You weren't clear exactly regarding the 768px thing so act accordingly here
return width * 0.2d;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}

Why is this XAML failing with "The property "Content" can only be set once."?

I've got this XAML:
<AppBarButton Icon="Protected" Label="Privacy Policy" >
<AppBarButton.Flyout>
<StackPanel>
<Flyout>
<TextBlock Text="Photrax extracts information from images you load into it. The information it extracts includes location information (where the photos were taken, when that is available) and the date and time the photo was taken. This data is stored in a local/internal/embedded (SQLite) database. This data is not stored in the cloud but only on your local device." TextWrapping="Wrap" FontSize="26" FontFamily="Verdana">
</TextBlock>
<TextBlock Text="To reiterate: Your data is not shared with anyone else. It is stored only on the device from which you use Photrax." TextWrapping="Wrap" FontSize="26" FontFamily="Verdana">
</TextBlock>
</Flyout>
</StackPanel>
</AppBarButton.Flyout>
</AppBarButton>
...which fails with, "The property "Content" can only be set once."
Why is there a problem with this, when the following XAML, which is basically the same, compiles fine:
<AppBarButton Icon="MapPin" Label="Colors In Use" Tapped="appbarbtnPhotosetColorMapping_Tapped">
<AppBarButton.Flyout>
<Flyout>
<StackPanel Background="Azure">
<TextBlock Text="Photoset:Pushpin Color Legend" TextWrapping="Wrap" FontSize="26" FontFamily="Verdana"></TextBlock>
<TextBlock x:Name="textblock0" Text="Unused" Foreground="Red" FontFamily="Segoe UI" FontSize="13" Margin="4" />
. . .
?
I get other err msgs with that xaml, too (about the following types being expected: flyoutbase and uielement), but I think it's the Content business that is giving me the business.
I pasted the problem code into kaxaml, but it doesn't even know what an AppBarButton is, and complained about that being an invalid element.
UPDATE
I can't test it yet, but I'm thinking that what Abdallah means is that I need to change this:
<StackPanel>
<Flyout>
. . .
</Flyout>
</StackPanel>
...to this:
<Flyout>
<StackPanel>
. . .
</StackPanel>
</Flyout>
You have two problems here :
1) The property "Content" can only be set once. :
You can't set the content for <Flyout> </Flyout> more than once and you set the content twice (Two TextBlocks) in first XAML code and in the working XAML once(One StackPanel), According to MSDN :
<Flyout>
singleUIElement
</Flyout>
singleUIElement :
A single object element that declares the content. This must be an
object that has UIElement in its hierarchy (plain strings don't work).
This can be a container, such as a Panel derived class, so that
multiple content items within the Flyout can be arranged in layout.
2) The following type was expected: "FlyoutBase".
You can't set Flyout property to any class that not derived from FlyoutBase class (i.e only Flyout and MenuFlyout ). you set the Flyout property in first XAML code to StackPanel and in the working XAML to Flyout .

How to programmatically create rectangle and textblock with binding element with c#?

I have the following code, which i want to programmatically create. Where the i is must be an integer into xaml! This is a sample Code from VISIBLOX.
<Rectangle Margin="20,0,0,5" Height="10" Width="10" Fill="{Binding ElementName=chart, Path=Series[i].LineStroke}" VerticalAlignment="Center" />
<TextBlock Margin="4,0,0,0" Text="{Binding ElementName=chart, Path=Series[i].DataSeries.Title}" />
<TextBlock Margin="4,0,0,0" Text="(" HorizontalAlignment="Left" />
<TextBlock Text="{Binding ElementName=chart, Path=Behaviour.Behaviours[0].CurrentPoints[i].Y, StringFormat=0.00}" Width="38" />
<TextBlock Text=")" HorizontalAlignment="Right" />
I can create a most programmatically but im stucking since 2 days with the Path=Behaviour.Behaviours[0].CurrentPoints[i].Y impossible for me to see how i can programmatically create it!
Thank u for help
Edit
IT's Work
TextBlock txtBlock3 = new TextBlock();
Binding txtBinding3 = new Binding();
txtBinding3.ElementName = "MainChart";
txtBinding3.Path = new PropertyPath("Behaviour.Behaviours[0].CurrentPoints[" + index +"].Y");
txtBlock3.SetBinding(TextBlock.TextProperty, txtBinding3);
txtBlock3.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
Panel.Children.Add(txtBlock3);
Presumably you're going to be building this Binding in a for loop of some sort?
If so, can't you do something like:
Binding b = new Binding { Path = new PropertyPath("Behaviour.Behaviours[0].CurrentPoints[" + i +"].Y”) };
Where the i there is the indexer in the for loop? I'm not sure I fully understand the problem so maybe you could elaborate with a bit more context?
If you’re trying to bind to a different thing depending on what is available in CurrentPoints, you might need to just bind to Benaviour.Behaviours[0] and use a converter to return the correct point’s Y value.
If you need any more help just let me know!