Windows Phone 8.1, binding to AppBarButton not rendering - windows-runtime

I'm displaying a string of several characters in an AppBarButton in a Windows Phone application. The string consists of the Segoe UI Symbol character "attach" (\uE16C) and a the number of items the user has already attached.
I've binded the AppBarButton's Icon property to a the number of items that have been attached, which is converted to a FontIcon.
<AppBarButton Icon="{Binding ItemCount, Converter={StaticResource IntToFontIconConverter}}"/>
However, for some reason the AppBarButton doesn't seem to always re-render when the FontIcon changes. I've vertified that the binding is updated and the AppBarButtons FontIcon changes, but it's not reflected on the phone's screen.
Is there someway to force the button to re-render when the FontIcon changes?

Check below code it might solve your problem
<AppBarButton Label="BitmapIcon" Click="AppBarButton_Click">
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/globe.png"/>
</AppBarButton.Icon>
find more details on https://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj662743.aspx

Related

Display Text with HTML image tag inside WPF control

I try to display a Text that contains a string plus HTML tags, and render images.
SourceText="TextToDisplay <img Source="Http://...cat.png"> and thats <b>it</b>";
RichTextBox doesnt work well.
I found some NuGet packages:
HtmlRenderer : But cannot access image that needs my Windows credentials to access, no way to send credential, so i got error 404 for images.
HtmlAgilityPack : Does not work for images
HtmlRichTextBoxBehavior : Does not work for images
I'm out of ressources....
Use case is I try to replicate TFS Description box in a WorkItem, it can contains HTML tags.
When i query TFS api to get Description, thats what we receives and i want to display the same box with the same iamges....
It's WPF, so you can just build whatever custom control you want very easily.
Start with a TextBlock and an Image control inside a StackPanel and go from there. It doesn't have to be any more complicated than that if you don't want it to. Or you can add a bunch of extra functionality if you need extra features. WPF gives you the flexibility to build whatever you want.
<StackPanel>
<TextBlock Text="TextToDisplay"/>
<Image Source="http://myUrl.../myImage.png"/>
</StackPanel>
This places them one after the other. If you want them to overlay one another, use a Grid to hold them. If you want a MouseOver effect, use a PopUp control. If you want an actual hyperlink in the UI, use the WPF Hyperlink element.

Windows phone 8.1 Universal app - Show the Button all the time

In Windows phone 8.1 universal app, Appbar currently support only icons, not the buttons. If i use the button, Button is hidden below the keyboard.
I need help to achieve either one of the below
I want to show the Button below the Keyboard, Any ways to achieve it?
Or, Move the Button above the Keyboard when keyboard appears. When Keyboard is not shown, Button should be at the Bottom of the page. Is there any way to do this?
It helps User to see the Button clearly all the time.
React on an OnInputPaneShowing event. The size of the input control is passed into this function and you can update the position of the button according this size.
See MSDN respond to the keyboard presence and MSDN occluded rect property for more info on how to do this.

Styling Windows Phone 8.1/WinRT AppBarButton

I'm currently looking to implement a CommandBar for a WinRT Windows Phone 8.1 app. Overall it is very straightforward but I am unable to style the control.
I have themed my app so that the accent colour has been changed to green. This works well for pretty much everywhere in the app (buttons, textblocks etc.) but not for the AppBarButton.
The brushes I'm overriding are SystemColorControlAccentBrush and PhoneAccentBrush but changing these does not make any difference to the colour of the AppBarButton when pressed:
Any idea what I'm doing wrong/can this colour be changed?
Set the CommandBar's foreground and background colors.
The command bar on Windows Phone is system UI not app UI and does not allow customizing the colors of individual AppBarButtons. Their colors always come from the CommandBar's colors.
try changing app bar button color
<AppBarButton x:Uid="SendMessageButton" Icon="Send" Foreground="" Background="" Command="{Binding SendMessageCommand}" IsEnabled="{Binding IsSendMessageButtonEnabled}"/>
or change in code behind
AppBarButton app = new AppBarButton();
app.Foreground="";
app.Background="";

How to simulate select behavior of LongListMultiSelector in a ListView on Windows Phone 8.1 Runtime

The Windows Phone Toolkit for Windows Phone 8.0 has a control called LongListMultiSelector that offers a really cool way to select items. It shifts the item content to the right slightly so users can tap that area in order to select that item. The default e-mail application has the exact behavior I want to achieve.
I'm trying to achieve the same behavior in a Windows Phone 8.1 Windows Runtime app, but am having a hard time to get it done. Since the LongListMultiSelector inherits from a simple Control I think it might be possible to convert it to Windows Phone 8.1 but I would rather not do that if I can avoid it.
Anyway, has anyone done this or know how to do it?
There's no reason to implement your DataTemplate with a CheckBox. ListView already supports multiple selection mode, and has supported it since WinRT and Windows 8.
Essentially, all you need to do is change the SelectionMode to multiple, and the CheckBoxes will appear on the left just like you're used to with LongListMultiSelector.
Let's say you have a dummy ListView like this one, with hardcoded items, to keep it simple:
<ListView x:Name="ListViewMultiSelector" SelectionMode="None">
<ListViewItem>Dog0</ListViewItem>
<ListViewItem>Dog1</ListViewItem>
<ListViewItem>Dog2</ListViewItem>
<ListViewItem>Dog3</ListViewItem>
<ListViewItem>Dog4</ListViewItem>
<ListViewItem>Dog5</ListViewItem>
</ListView>
If you change the SelectionMode in code behind (on some event, button click, page tap, swipe, whatever)
this.ListViewMultiSelector.SelectionMode = ListViewSelectionMode.Multiple;
it will show the CheckBoxes.
In the SelectionChanged event (in SelectionChangedEventArgs to be more exact) you can get AddedItems and RemovedItems, a list of objects - IList. AddedItems contains the latest selected items which may have triggered the SelectionChanged, and the RemovedItems contains the latest unselected items which may have triggered the SelectionChanged.
#konikos, #Benjamin Diele
This in the XAML
<ListView SelectionMode="Single" SelectionChanged="ListMovimentos_OnSelectionChanged" Padding="0 0 0 40" ItemsSource="{Binding ListMovimentos}" ItemContainerStyle="{StaticResource ListItemsContainerGeneric}" x:Name="ListMovimentos"></ListView>
and this in the code behind
private void ListMovimentos_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (ListMovimentos.SelectedItems.Count > 0)
{
ListMovimentos.SelectionMode = ListViewSelectionMode.Multiple;
}
else
{
ListMovimentos.SelectionMode = ListViewSelectionMode.Single;
}
}
Did the trick for me and got the animation like Windows Phone LongListMultiSelector.

Suggestions for a Flipview with Pages inside (Windows 8.1 app)

I'm trying to create an app which shows a different page on swiping left or right.
I'm using the flipview control and loading it with Page class objects.
It works well, but when I select a textbox inside, the control recieving the focus is the flipview instead of the textbox, and then the keyboard covers it.
My question is, how I should implement his UI?
The actual structure is something like (this is not real code, but the simpliest way to show the structure)
<Page>
<FlipView> <---- This gets the focus instead of the textbox
<SetupPage>
<TextBox1 /> <--- This textbox is clicked and shows the keyboard
</SetupPage>
<AnalyzePage>
<TextBox2 />
</AnalyzePage>
</Flipview>
</Page>
I've tried using FlipViewItem around the pages, and also trying to override the focus logic of the flipview. I haven't suceeded in any case.
Thanks!