|
Wrong forum.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
Not wrong forum. The people from the algorithm forum sent me here.
|
|
|
|
|
And yet you say you have a problem with an algorithm, ergo it's an algorithm forum post.
|
|
|
|
|
A game algorithm in a Silverlight app.
|
|
|
|
|
Hello All,
I have issue with WCF ASYNC call. WCF service give me a random response. Sometimes it gives me result and sometimes not. I have set max values for binding related properties.
Can anyone can help me to figure out this issue?
Thanks
|
|
|
|
|
This could be something to do with the timeout or buffer size.
Try changing these settings.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
Hi,
I wouold like to learn a little about how to design better UI in silverlight or WPF in visual studio.
1-
Is there a book to teach me that in visual studio xaml or should I buy a step by step book in expressin blend? I say expression blend because it seems that I can use the code in expression blend and paste the xaml into visual studio.
Thank you
|
|
|
|
|
I don't know a book to recommend, but you don't need to paste code into visual studio. Expression Blend works with Visual Studio solutions/projects so you can edit (and run) code in Blend and edit and debug in Visual Studio as well.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
To learn better design, Expression Blend would be a better bet than Visual Studio.
As already pointed out, you can edit xaml in Expression Blend as well.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
Yes "Good Answer". You can use Expression Blend to create the UI styles very easily which is very very difficult if you are using Visual Studio to design. Visual Studio requires depth knowledge on XAML. Also more effort is require if you are designing using the VS. Use Expression Blend which will help you a lot.
Silverlight 5 Tutorials : 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
|
|
|
|
|
|
|
You're welcome and that's what we're here for - to help!
|
|
|
|
|
Hey all,
I'm running into a problem when binding a property of a GroupItemTemplate (in the WP7 LongListSelector) to a converter I built. I want the converter to check if there are items to be displayed in the group, and according to if there are items, set a Brush to the background.
This is my code for the Converter:
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is Group<TrackInfo>)
{
Group<TrackInfo> group = value as Group<TrackInfo>;
if (group != null)
{
if (group.Items.Count == 0)
return (SolidColorBrush)Application.Current.Resources["PhoneChromeBrush"];
else
return (SolidColorBrush)Application.Current.Resources["PhoneAccentBrush"];
}
}
return new SolidColorBrush(Color.FromArgb(128, 255, 0, 0));
}
And this is in my XAML:
<DataTemplate x:Key="groupItemTemplate">
<Border Width="99" Height="99" Background="{Binding Converter={StaticResource groupItemBackgroundBrush}}" Margin="6" IsHitTestVisible="{Binding HasItems}">
<TextBlock Text="{Binding GroupTitle}"
FontFamily="{StaticResource PhoneFontFamilySemiBold}"
FontSize="36"
Margin="{StaticResource PhoneTouchTargetOverhang}"
Foreground="{StaticResource PhoneForegroundBrush}"
VerticalAlignment="Bottom"/>
</Border>
</DataTemplate>
<valueConverters:TrackGroupToGroupItemBackgroundBrushConverter x:Key="groupItemBackgroundBrush" />
...
<toolkit:LongListSelector x:Name="lstTracks" Height="800" Width="480" DisplayAllGroups="True"
ListHeaderTemplate="{StaticResource listHeader}"
ListFooterTemplate="{StaticResource listFooter}"
ItemTemplate="{StaticResource itemTemplate}"
GroupHeaderTemplate="{StaticResource groupHeaderTemplate}"
GroupItemTemplate="{StaticResource groupItemTemplate}">
<toolkit:LongListSelector.GroupItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</toolkit:LongListSelector.GroupItemsPanel>
</toolkit:LongListSelector>
I get an Unspecified Error, wich isn't exactly quite helpful... Is there a better way to find out if the group has items and accordingly set a Brush? Or is there an error in my code I don't see?
Thanks for helping,
MadMatt
|
|
|
|
|
You need to have the converter instance in resources somewhere visible to the datatemplate (just like the other static resources you are binding to) so the StaticResource binding works.
Mark Salsbery
Microsoft MVP - Visual C++
modified on Wednesday, July 13, 2011 5:58 PM
|
|
|
|
|
The DataTemplate as well as the Converter are in the
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="groupItemTemplate">
<Border Width="99" Height="99" Background="{Binding Converter={StaticResource groupItemBackgroundBrush}}" Margin="6" IsHitTestVisible="{Binding HasItems}">
<TextBlock Text="{Binding GroupTitle}"
FontFamily="{StaticResource PhoneFontFamilySemiBold}"
FontSize="36"
Margin="{StaticResource PhoneTouchTargetOverhang}"
Foreground="{StaticResource PhoneForegroundBrush}"
VerticalAlignment="Bottom"/>
</Border>
</DataTemplate>
<valueConverters:TrackGroupToGroupItemBackgroundBrushConverter x:Key="groupItemBackgroundBrush" />
</phone:PhoneApplicationPage.Resources>
Is there something wrong in here?
|
|
|
|
|
_Madmatt wrote: Background="{Binding Converter={StaticResource groupItemBackgroundBrush}}"
The problem here is that you haven't told the converter what it should bind to. Try changing this to be
"{Binding Path=., Converter={StaticResource groupItemBackgroundBrush}}"
|
|
|
|
|
No, still getting the exception with this setting...
|
|
|
|
|
Put a breakpoint in your converter and see if it gets hit. Then step over the code to see what breaks.
|
|
|
|
|
It's not even hitting the converter!
Not with this XAML:
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="groupItemTemplate">
<Border Width="99" Height="99" Background="{Binding Path=., Converter={StaticResource groupItemBackgroundBrush}}" Margin="6" IsHitTestVisible="{Binding HasItems}">
<TextBlock Text="{Binding GroupTitle}"
FontFamily="{StaticResource PhoneFontFamilySemiBold}"
FontSize="36"
Margin="{StaticResource PhoneTouchTargetOverhang}"
Foreground="{StaticResource PhoneForegroundBrush}"
VerticalAlignment="Bottom"/>
<Border.Resources>
<valueConverters:TrackGroupToGroupItemBackgroundBrushConverter x:Key="groupItemBackgroundBrush" />
</Border.Resources>
</Border>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
And not with this one too:
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="groupItemTemplate"
<Border Width="99" Height="99" Background="{Binding Path=., Converter={StaticResource groupItemBackgroundBrush}}" Margin="6" IsHitTestVisible="{Binding HasItems}">
<TextBlock Text="{Binding GroupTitle}"
FontFamily="{StaticResource PhoneFontFamilySemiBold}"
FontSize="36"
Margin="{StaticResource PhoneTouchTargetOverhang}"
Foreground="{StaticResource PhoneForegroundBrush}"
VerticalAlignment="Bottom"/>
</Border>
</DataTemplate>
<valueConverters:TrackGroupToGroupItemBackgroundBrushConverter x:Key="groupItemBackgroundBrush" />
</phone:PhoneApplicationPage.Resources>
|
|
|
|
|
Not sure, maybe I'm wrong, but have you tried to put converter definition before your datatemplate?
|
|
|
|
|
Thanks! This did the trick! Too bad I didn't think of that myself...
|
|
|
|
|
Try by making this line - <valueConverters:TrackGroupToGroupItemBackgroundBrushConverter x:Key="groupItemBackgroundBrush" />; part of the Itemsources or UserControls resource.
|
|
|
|
|
They are both part of the <phone:PhoneApplicationPage.Resources> , I cannot create a <DataTemplate.Resources> , so where should I put it else? This is quite confusing to me, it's the first time is use XAML binding in such a complex way...
Thanks
|
|
|
|
|
I have created simple SL business application. I am trying to learn membership and authentication and configured the following:
1. Install the ASPNETDB
2. Part of the Web.config looks like this
<roleManager enabled="true" />;
<authentication mode="Forms">;
<forms name=".Test_ASPXAUTH" />;
</authentication>>
<profile>
<properties>
<add name="FriendlyName" />
</properties>
</profile>
</system.web>
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=TPSA11;Initial Catalog=aspnetdb;Integrated Security=True" />
<add name="TestEntities" connectionString="metadata=res://*/TestModel.csdl|res://*/TestModel.ssdl|res://*/TestModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=TPSA11;Initial Catalog=Test;Persist Security Info=True;User ID=sa;Password=service;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
3. In App.Xamel.cs
InitializeComponent();
WebContext webContext = new WebContext();
webContext.Authentication = new FormsAuthentication();
4. The home page contains a datagrid that gets populated but to force authentication I added
[RequiredRole(“ADMIN”)]
Before the query used to populate the datagrid.
When I execute the application within VS2010 (debug mode), the datagrid is empty until a login with credentials with ADMIN role then it gets populated.—so far so god.
But when I run the application outside VS (e.g. http://servername:port/testApp.html the datagrid is loaded by default . If I try to login anyways, I get an error:
“Load operation failed for query “login” “System.ServiceModel.DomainServices.Client.DomianOperation” was thrown”
This is also captured using fiddler:
@_Fault_5http://schemas.microsoft.com/ws/2005/05/envelope/none@_Code@_Value_Sender_@_Reason@_Text__xml_lang_en-US>Login and Logout can only be invoked for Forms authentication._@_Detail@_DomainServiceFault__DomainServices _i)http://www.w3.org/2001/XMLSchema-instance@ ErrorCode_@
ErrorMessage>Login and Logout can only be invoked for Forms authentication.@_IsDomainException@
StackTraceL_ at System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1.Login(String userName, String password, Boolean isPersistent, String customData)
at Login(DomainService , Object[] )
at System.ServiceModel.DomainServices.Server.ReflectionDomainServiceDescriptionProvider.ReflectionDomainOperationEntry.Invoke(DomainService domainService, Object[] parameters)
at System.ServiceModel.DomainServices.Server.DomainOperationEntry.Invoke(DomainService domainService, Object[] parameters, Int32& totalCount)
at System.ServiceModel.DomainServices.Server.DomainService.Query(QueryDescription queryDescription, IEnumerable`1& validationErrors, Int32& totalCount)
at System.ServiceModel.DomainServices.Hosting.QueryProcessor.Process[TEntity](DomainService domainService, DomainOperationEntry queryOperation, Object[] parameters, ServiceQuery serviceQuery, IEnumerable`1& validationErrors, Int32& totalCount)
Any help is greatly appreciated
|
|
|
|