WinRt :XAML Tag doesnot exist in the namespace - windows-store-apps

I am creating a project to which I want to validate textbox ,therefore use prism for that and implementing example like this below
http://msdn.microsoft.com/en-us/library/windows/apps/xx130660.aspx
All I have implemented worked fine but when I changes the code in Page's xaml than it doesn't find the classes etc. which I have implemented .
For Example
<prism:VisualStateAwarePage
xmlns:prism="using:Microsoft.Practices.Prism.StoreApps"
xmlns:vm="using:PrismExample.ViewModels"
xmlns:Behaviors="using:PrismExample.Behaviors"
x:Class="PrismExample.Views.UserInfoView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
<Page.DataContext>
**<vm:UserInfoViewModel/>**
</Page.DataContext>
<TextBox x:Name="FirstNameValue" Grid.Row="2"
Text="{Binding UserInfo.FirstName, Mode=TwoWay}">
<interactivity:Interaction.Behaviors>
<!--<Behaviors:HighlightFormFieldOnErrors PropertyErrors="{Binding UserInfo.Errors[FirstName]}">-->
**<quickstartBehaviors:HighlightFormFieldOnErrors** PropertyErrors="{Binding UserInfo.Errors[FirstName]}" />
</interactivity:Interaction.Behaviors>
</prism:VisualStateAwarePage>
Now here ,the bold text gives the error that it doesnot exists in the namespace.
Can anybody help me out of this. How I can I get rid of this.

You have:
<Page.DataContext>
**<vm:UserInfoViewModel/>**
</Page.DataContext>
Should this be:
<prism:VisualStateAwarePage.DataContext>
<vm:UserInfoViewModel/>
</prism:VisualStateAwarePage.DataContext>

In your code, you reference quickstartBehaviors but you only have an XMLNS of Behaviors defined in your page. You should look where HighlightFormFieldOnErrors is defined.
Let's pretend that works. But, Noor, I am not sure how to say this. Validation on a control is different than validation in the view model. What I mean is, I think there might be a better way for your to consider. If you are interested, read this: http://blog.jerrynixon.com/2014/07/lets-code-handling-validation-in-your.html
Best of luck!

Related

WinRT ListView and ExpanderView issues

After, what I thought was a successful porting of Windows Phone toolkit ExpanderView to WinRT, I noticed that it not working 100% as it should.
Here is what i'm trying to do:-
I have a ListView with the ItemsSource being databound, inside the ItemTemplate of this ListView there is a ExpanderView which I port???!!! The idea is that, I want the expander view to expand when I tap on the ListView item.
This per say, is happening BUT when the ExpanderView expands, it overlap the next ListView item, i.e ListViewItem Height is not changing. Why is that I really don't know. Been trying every possible idea I came up with to solve this but in vain :(
Can anyone helps me and guide me in the right direction?
Below is a link to a simple example (VS project with all the necessary code) to demo the problem
Simple Universal App to demo the problem
Thanks in advance
There are quite a few places where you have animations that are making layout changes. These animations are very UI-thread heavy, so require the property EnableDependentAnimations to be set to True. You can find more out about it here. You will likely need to go into the styles and manually change the VisualStates to make this change. One such example is:
In your ExpanderResource.xaml:
<VisualStateGroup x:Name="ExpansionStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Collapsed"
GeneratedDuration="0:0:0.15" To="Expanded">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="ItemsCanvas" EnableDependentAnimation="True">
<EasingDoubleKeyFrame EasingFunction="{StaticResource QuadraticEaseOut}" KeyTime="0:0:0.00" Value="0" />
<EasingDoubleKeyFrame x:Name="CollapsedToExpandedKeyFrame" EasingFunction="{StaticResource QuadraticEaseOut}" KeyTime="0:0:0.15" Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
</VisualStateGroup>
Note that the DoubleAnimationUsingKeyFrames targetting (FrameworkElement.Height) requires EnableDependentAnimations="True", as this affects the layout.
This is not the only place in that file that needs to be fixed. Further, I don't think it will solve all of your layout problems. It will get it property expanding the layout though.
Be sure you are using a stackpanel as your panel.
<ListView>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
Best of luck!

No richtextbox control in WinRT (8.1)?

Was hoping code lines like this will work on WinRT:
<!--A RichTextBox with hyperlink.-->
<RichTextBox IsReadOnly="True">
<Paragraph>
Displaying text with <Hyperlink NavigateUri="http://www.msdn.com" TargetName="_blank">hyperlink</Hyperlink>.
</Paragraph>
</RichTextBox>
The end result I'm looking for is to turn this:
Hey #Jake
to this:
Hey Jake Dawson, how are you.
Once the user hits space after the #word.
Since you want to set it to IsReadonly="True", why don't you use a RichTextBlock?
See http://msdn.microsoft.com/library/windows/apps/br227565
If you are only after the ability to include a hyperlink, you can do that in a regular TextBlock as well (in Windows 8.1), see http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.documents.hyperlink.aspx
UPDATE:
After your clarification of the question, it seems that you do need an editing capability. Look at
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.richeditbox.aspx

LongListMultiSelector - can you Suppress the Default Tap Behaviour that puts List into edit mode?

Ok, I hope this doesn't have an embarrassingly obvious answer, but I could not find a solution through searching.
I'd like my longlistmulti to function basically like the Mail app, i.e. having the "select" appbar button put the list into Edit mode, so you can perform operations on it.
However I'd like to suppress the behavior where the list is responding to a tap on the left side of any of the items, that first 10% part of the item's width, that puts the List in the Edit mode.
I have a button as part of the item template, that is pretty flush against the left side, that I need as a trigger for it's own event handler for each item.
So I just want to block the event that is putting it into edit mode via tapping on items. Hope this can be done.
Steve
A quick addit'l note: I'd like to suppress this default behavior regardless, even if I do decide to not have that button as my final implementation.. i didn't want to factor that button as a permanent consideration.
You have a couple of options here. One is handling the IsSelectionEnabledChanged event, and the other is modifying the control template. If you want to place the list into edit mode yourself, I'd suggest using the template modification method, as the event handler might be a bit convoluted when it comes to determining where the change event came from.
From the Document Outline pane (CTRL+W, U to make visible), right click your list control, and navigate to Edit Additional Templates => Edit ItemContainerStyle => Edit a Copy... Use the dialog to name and place the template in your preferred resource dictionary. Look for the rectangles named InnerHintPanel and OuterHintPanel and delete them. This will remove the hit area for activating edit mode. The XAML for these rectangles is reproduced below.
<Grid HorizontalAlignment="Stretch">
...
<Rectangle x:Name="InnerHintPanel" Grid.Column="0" Width="24"
Height="{TemplateBinding HintPanelHeight}"
HorizontalAlignment="Left"
Fill="Transparent"
StrokeThickness="0">
<Rectangle.RenderTransform>
<CompositeTransform TranslateX="24"/>
</Rectangle.RenderTransform>
</Rectangle>
...
</Grid>
<Rectangle x:Name="OuterHintPanel" Width="24"
HorizontalAlignment="Left"
Height="{TemplateBinding HintPanelHeight}"
Fill="{TemplateBinding Background}"
StrokeThickness="0" Opacity="0.0"/>
You should probably delete all storyboard animations that have Storyboard.TargetName set to one of these elements' names as well, otherwise the transition in control state will cause exceptions if you enter edit mode and those elements cannot be found.

Force GridView To Create Not Recycle Controls

I have a GridView in a windows store app that has an ItemContainerStyleSelector. Within the style is an Image control that has a custom dependency property to set the source (This is so I can get a handle on the Image and hook up to the unloaded event).
My issue is the Image is never unloaded and seems to be reused. This means that when I set the source, the image is set on other items in the GridView as well (For Example I have an object which has no image but after scrolling away and then back again it has an image from another object).
I've tried to set virtualization mode to standard where I can but it doesn't help. Any ideas would be greatly appreciated.
Here is the Image that is contained in the style. This is passed to a method "OnRemoteURISourceChanged" when set. I'd expect a different image control whenever the method is called but this is not the case.
<Image x:Name="BackgroundImage" DataContext="{Binding CurrentBackdrop}" helpers:ImageExtensions.RemoteURISource="{Binding Uri}" Stretch="UniformToFill"/>
And here is my GridView
<GridView x:Name="ItemsGrid" Grid.Row="1" ItemsSource="{Binding BrowseResults}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" Margin="20,0,20,0"
IsItemClickEnabled="True" ItemClick="ItemsGrid_ItemClick" VirtualizingStackPanel.VirtualizationMode="Standard">
<GridView.ItemContainerStyleSelector>
<controls:UPnPCDStyleSelector CDObject="{StaticResource somestyle1}" Container="{StaticResource somestyle2}" Item="{StaticResource somestyle3}"/>
</GridView.ItemContainerStyleSelector>
<GridView.ItemsPanel>
<ItemsPanelTemplate VirtualizingStackPanel.VirtualizationMode="Standard">
<WrapGrid Orientation="Vertical" VirtualizingStackPanel.VirtualizationMode="Standard"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
UPDATE: The issue appears to be the WrapGrid. If I change this to a VirtualizingStack Panel and set the VirtualizationMode to Standard then everything works as expected but obviously my items then only appear on one line and not multiple lines as I wish.
How do I set the virtualization mode of a WrapGrid?
Is there a chance your helpers:ImageExtensions.RemoteURISource doesn't clear the Image.Source when either your CurrentBackdrop property or its Uri property value is null?
Are you sure the task which is loading the img source returns to default ui context when awaiting? I don't think it is a good idea to set Image.Source property form code. The better solution would be to create a custom observable task class and bind im source to it's result. In the background you can call the task. Do you need the control to be Image? Because if it would be a control with template, it would be easier for you to do that. I can send you the class which does that if you want to.

How can I redesign Magento toplinks?

I have browsed through many articles, but none of them mention how I can go about redesigning the toplinks at the top of any Magento store.
Does anyone know how I can modify the default links which are found in the top right of my Magento store and assign an icon to each link and also spread the links across the full width of the top area.
It may include something like the below (example only).
Any suggestions would be much appreciated.
My website is: www.efficienttrade.co.nz if that helps.
Thanks,
Jason
Find the top.links in layout xml files and add a class. Then, you can customize this class via css.
For instance,
<!-- this piece of code available in rss.xml, look at the class define -->
<reference name="footer_links">
<action method="addLink" translate="label title" module="rss" ifconfig="rss/config/active"><label>RSS</label><url>rss</url><title>RSS</title><prepare>true</prepare><urlParams/><position/><li/><a>class="link-rss"</a></action>
</reference>
Same as Ogüz answer + more information:
You have to be a little bit like Sherlock Holmes.
The top links are generated thanks to a block that you can find in the layout file page.xml of your theme. Then search the block name "topLinks" in the header block (in the default theme, it's the name) and you will find <block type="page/template_links" name="top.links" as="topLinks"/>. This block topLinks is generated thanks to the block class Mage_Page_Block_Template_Links. The important method in this block is public function addLink(...), it means that you will have to search into the xml layout the following element/tag <action method='addLink'>...</action>.
An example for the customer module, in the file customer.xml of the layout folder:
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
You should find more than one xml element which uses this kind of method.
Pay attention, the addLink method can also be called programmatically (into PHP code), not only in layout file.
Hope it helps