i have a problem with the dotfuscor.
I'm using a app with localization and i bind the data like:
Text="{Binding Path=Localizedresources.Foo, Source={StaticResource LocalizedStrings}}"
or
Header="{Binding Localizedresources.Today, Mode=OneWay}" DataContext="{StaticResource LocalizedStrings}"
the problem is, that dotfuscator dont likes this and i get the message e.g.:
XamlAnalysis flagged something in Resource Main.g.resources\mainpage.xaml at (111, 55) for the following reasons: Binding expression {Binding Localizedresources.Today, Mode=OneWay} :Could not resolve, may have to manually exclude.
but i dont know how to fix it or even how to exclude this because i dont know in which step the error is like "string encryption".
how to solve this?
Related
I want to create a class library for my Windows 8.1 project, which includes all the views for my app. So I've created the project, but Visual Studio told me that it is not possible to access the StaticResources.
<StackPanel>
<TextBlock
Text="123"
Style="{StaticResource HeaderTextBlockStyle}" />
<TextBlock"
Text="456"
Style="{StaticResource HeaderTextBlockStyle}" />
</StackPanel>
For example 'HeaderTextBlockStyle' was marked in blue and it told me that the resource 'HeaderTextBlockStyle' could not be found. So I can't see my page in the designer, because of the issue.
I can run my app without problems, but how can I get access to the StaticResources?
In Windows 8.1 some things have changed, including the inclusion of the StandarStyles.xaml (it's no longer included explicitly). This guide is very helpful to make the transition: http://blogs.windows.com/windows/b/appbuilder/archive/2013/07/24/windows-8-to-windows-8-1-preview-starting-with-the-xaml-templates.aspx
For your specific problem I recommend you to try:
Style="{ThemeResource HeaderTextBlockStyle}"
After being advised that the native ComboBox was not the way to go I was told to look at the Silverlight Toolkit ListPicker. So I did and have got a problem.
I opened a new project and pulled a new ListPicker onto the MainPage. The ListPicker looks like:
<toolkit:ListPicker x:Name="Result">
<toolkit:ListPickerItem Content="Win" />
<toolkit:ListPickerItem Content="Place" />
<toolkit:ListPickerItem Content="Lose" />
</toolkit:ListPicker>
When trying to run this I get an XamlParseException with InnerException of InvalidProgramException. All I did was drag the control on, and add some ListPickerItem. Removing the items still results in the error, removing the ListPicker control completely allows the page to be shown with no error.
I'm sure I've missed something, but any documentation I have read seems to point towards this markup being fine, including http://windowsphonegeek.com/articles/listpicker-for-wp7-in-depth
I can provide any other info required.
ListPickerItem is a class used internally by the ListPicker and should not be used directly.
If you just want to add a list of items, you can use strings to do it, like this:
Add a new namespace on top of the Page to access the String class:
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Then, just change the ListPicker code to this:
<toolkit:ListPicker>
<sys:String>Win</sys:String>
<sys:String>Place</sys:String>
<sys:String>Lose</sys:String>
</toolkit:ListPicker>
The problem was that the wrong dlls had been registered, i.e. 7 and not 7.1. I had to uninstall and reinstall to get it to update correctly and it worked.
This line works in Windows Phone 7.0 but not in 7.1 (NullReferenceException thrown). Note that I checked that Name is never null or empty.
<CheckBox x:Name="{Binding Name}" Content="{Binding Label}" />
Removing x:Name, all things being equal, prevent the app to crash. Why is that ?
You can't bind x:Name , it's the equivalent of declaring a variable in C#. And it doesn't make sense to do either, as it's not a visual property.
Surely you meant to bind the Header property of the CheckBox?
My openion is Name property didn't take at runtime.
When you upgraded from 7.0 to 7.1 the xmlns:x in your header might be wrong. create a brand new page and make sure that that line is the same.
Having followed Laurent's upgrade guide http://www.galasoft.ch/mvvm/installing/mangobeta/ to get from an existing MVVMLight WP7 project to a WP71 project. I have changed the references and namespaces corectly. But the EventTrigger is not recognised in the XAML
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<cmd:EventToCommand
Command="{Binding Mode=OneWay, Path=LoadedCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
I get an error on the EventTrigger element.
Has it changed?
I had this exact same problem when I upgrade my application from WP7 to WP7.1(Mango). The problem was the MVVM Light Binaries. You need to upgrade to the WP7.1 Binaries.
Laurent Bugnion ( https://stackoverflow.com/users/12233/lbugnion ) explains how to upgrade the MVVM Light binaries on his website here: http://www.galasoft.ch/mvvm/installing/mangobeta/
These are the essential steps I used to fix my problem:
Download the most recent version from here.
Open and Compile the WP71 project.
Copy the binaries to your MVVM Binary location (in my case C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries)
Open your project
In the References folder, delete GalaSoft.MvvmLight, GalaSoft.MvvmLight.Extras and System.Windows.Interactivity.
Add the new references from the folder C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\WP71.
I had a similar problem after upgrading to Mango. In my case, I had the EventToCommand binding on a MenuItem click, but you seem to have it on some sort of loaded event. You could try using an anonymous delegate in the loaded evcent from the view's code-bhind. Ie:
this.Loaded+=(s,e)=>ViewModel.LoadedCommand.Execute(null);
In my case, I changed from:
<tk:MenuItem Header="Delete Snapshot" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<mvvmLight:EventToCommand Command="{Binding DeleteSnapshotCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem,ElementName=lstSnapshots}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</tk:MenuItem>
to
<tk:MenuItem Header="Delete Snapshot" Command="{Binding DeleteSnapshotCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem,ElementName=lstSnapshots}" />
I have moved on from this issue, by reverting back to pre-mango dev environment.
Not the solution I wanted, but - onwards and forwards.
It would be nice if in XAML when I define ItemsControl/ItemsSource="{Binding AvailableContracts}" that Visual Studio would be smart enough to go find the property AvailableContracts on the ModelView which the DataContext is bound to, reflect it, and then when I type:
<TextBlock Text="{Binding Path=
it would pop up intellisense of the bindable properties that are available to me in my ContractModelView since AvailableContracts is a List collection.
I don't see why Visual Studio can't go follow this logical path and give me the needed intellisense. Can anyone explain what the disconnect here is? Or surely there is some way to "give it some help" so that it could provide intellisense. Any third-party tools to do this? Perhaps in VS2010? I hear MEF is going to make intellisense much better in VS2010, hope so.
This lack of databinding intellisense when writing my XAML views just feels like notepad. :-(
<UserControl
x:Class="TestMvvmWpf8898.Views.CustomerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<StackPanel>
<TextBlock Text="{Binding Path=FullName}"/>
<ItemsControl ItemsSource="{Binding Path=AvailableContracts}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=NEED_INTELLISENSE_HERE
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</UserControl>
there is only one good solution for your problem: Resharper
It is possible from Visual Studio 2013 http://blogs.msdn.com/b/visualstudio/archive/2013/08/09/xaml-editor-improvements-in-visual-studio-2013.aspx