I want to program an application based on wpf c# language.
I've got the bing map running and i want the dataset to display on the map with pushpin on top of the specific locations.
I don't know if you could make it work but i could do this whit this few lines of XAML code and Binding.
<bing:MapItemsControl ItemsSource="{Binding LocationsList}">
<bing:MapItemsControl.ItemTemplate>
<DataTemplate>
<bing:Pushpin Location="{Binding Location}" Content="{Binding Content}">
</bing:Pushpin>
</DataTemplate>
</bing:MapItemsControl.ItemTemplate>
</bing:MapItemsControl>
Related
<ListBox x:Name="lstbox" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Visible">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
I am able to create horizontally scrolling list of images via this design time code.
Right now i am able to add images at runtime,
But i am not able to produce same effect via code in runtime....
One way to go:
string xaml =
"<ListBox x:Name='lstbox' ScrollViewer.VerticalScrollBarVisibility='Disabled' ScrollViewer.HorizontalScrollBarVisibility='Visible'>"+
"<ListBox.ItemsPanel>"+
"<ItemsPanelTemplate>"+
"<StackPanel Orientation='Horizontal' />"+
"</ItemsPanelTemplate>"+
"</ListBox.ItemsPanel>";
UIElement tree = (UIElement)XamlReader.Load(xaml);
LayoutRoot.Children.Add(tree);
How to disable Drop-down arrow in combo-box in Metro-style app(Windows 8)
If you permanently want to disable it, just edit the ControlTemplate. You can remove this, the popup... or do a variety of other basic template edits to cause it to not to function anymore.
In particular, the named entity DropDownGlyph:
<TextBlock x:Name="DropDownGlyph" Grid.Column="1"
Foreground="{StaticResource ComboBoxArrowForegroundThemeBrush}"
FontWeight="Bold"
FontSize="{StaticResource ComboBoxArrowThemeFontSize}"
FontFamily="{StaticResource SymbolThemeFontFamily}"
HorizontalAlignment="Right" IsHitTestVisible="False"
Margin="0,0,6,4" Text=""
VerticalAlignment="Center"/>
If it's a temporary thing, given your scenario of wanting to toggle, then the easiest would be to use two controls, a TextBlock and a ComboBox. Toggle the Visibility (using The BooleanToVisibilityConverter and BooleanNegationConverter which is included in many of the VS2012 templates) based on another property (such as ShowAsComboBox). Bind both the TextBlock and the ComboBox to the same property. As long as both controls share a common parent and location, it should look fine.
Just started with developing for WP7 and came across the following. I have a pivot application with a few pivotitems. On the first pivotitem (see code below) I want to be able to adjust a lot of settings. For this question all items to be set are called 'TextBox' and the choice in the ListPicker is either A,B or C.
Now if I do NOT use the ScrollViewer and I tap any of the listpickers I get to see all three options BUT I can not scroll through all listpickers.
If I DO use the ScrollViewer, I CAN see all listpickers but only the top one (that's visible) will expand and give me the options A,B and C, they others stay collapsed.
How can I get every listpicker to expand and show me the avaiable options AND be able to scroll to every listpicker on the page?
PS In code below copy the stackpanel between start and end about 15 times.
Thanks in advance for any help!
<controls:PivotItem Header="blabla">
<ScrollViewer>
<StackPanel Margin="0,0,36,0" VerticalAlignment="Top" d:LayoutOverrides="Width">
// start
<StackPanel Orientation="Horizontal">
<TextBlock TextWrapping="Wrap" Text="TextBox" Width="80" TextAlignment="Right" Margin="10,22,20,0" HorizontalAlignment="Right" VerticalAlignment="Top" />
<toolkit:ListPicker Margin="0" Width="275">
<toolkit:ListPickerItem Content="A"/>
<toolkit:ListPickerItem Content="B"/>
<toolkit:ListPickerItem Content="C"/>
</toolkit:ListPicker>
</StackPanel>
// end - copy/paste code code between start and end about 15 times right here
</StackPanel>
</ScrollViewer>
</controls:PivotItem>
This is, apparently, a common issue with Listpicker and ScrollViewer. You can find a workaround here
Should anybody stumble upon this, this has been fixed since the november 2011 release of the wP7 silverlight toolkit.
This is the code:
<ItemsControl x:Name="ContactsControl" ItemsSource="{Binding Contacts}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding ElementName=ContactsControl, Path=DataContext.PageName}" />
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
On the TextBlock I want to get date from the ItemsControl data context, so I use ElementName and in the 'Path' I use Path=DataContext.PageName.
So, On Blend I can see the data on the TextBlock as it should be, but when I run the emulator I cant see the data...
Why is it?
I'm working with VS2010 and Blend 4.
Thanks.
You are binding an items control to a list of Contacts. Traditionally you will then bind the textblock to a property of the class contained in the list. Why are you binding to another control and then bringing datacontext into the equation? Doesn't seem like something you normally do with a list.
How can I draw on bing maps? Or actually I'd like to add a marker. I have detected coordinates and now I want to display this place on a map with a marker...
To draw lines on a map you use the MapPolyline element as a child of the Map control. To add a marker to the Map control, you add a Pushpin element as a child of the Map control. To add multiple items (lines or pushpins) you add a MapItemsControl as a child of the Map control and specify the ItemsSource and ItemTemplate.
The following code example shows a PushPin to display the current location, and a MapItemsControl to show waypoints on a route:
<maps:Map x:Name="_map"
CopyrightVisibility="Collapsed"
CredentialsProvider="Your API Key Here"
LogoVisibility="Collapsed">
<maps:MapItemsControl ItemsSource="{Binding WayPoints}">
<maps:MapItemsControl.ItemTemplate>
<DataTemplate>
<maps:Pushpin Background="{Binding BackgroundBrush}" Location="{Binding Location}"/>
</DataTemplate>
</maps:MapItemsControl.ItemTemplate>
</maps:MapItemsControl>
<maps:Pushpin x:Name="_current" Background="Blue" Location="{Binding CurrentLocation}"/>
</maps:Map>
This blog post may also help you get started.