|
Thanks mate. As long as there's a SOLVED somewhere to indicate that the issue is resolved, that's the main thing. As he always thanks me, I'm happy with that - and I'll always upvote a thanks.
|
|
|
|
|
Pete O'Hanlon wrote: As he always thanks me
Sure the guy is polite and appreciative but quite possibly does not realise that an upvote has value unto itself.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well, I don't think he's going to have that much of an overall effect on my reputation
|
|
|
|
|
Hi,
I am using silverlight 4.
My project has navigation frame.
page1.xaml has a datagrid which can sometimes have many records.
If the datagrid in page1.xaml has many records, then I do not see the records at the bottom of the datagrid. And there is no scrollbar to scroll to the bottom of the data in the datagrid.
Can you see what is wrong with this xaml in the mainpage.xaml please?
<Border Margin="10,10,10,12" Padding="10" BorderBrush="DarkGray" BorderThickness="2"
CornerRadius="4" Grid.Row="1" Grid.Column="1">
<navigation:Frame x:Name="mainFrame" UriMapper="{StaticResource UriMapper}"
Source="Home" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
</navigation:Frame>
</Border>
Thank you
modified on Thursday, March 31, 2011 4:16 AM
|
|
|
|
|
Wrap navigation:Frame in a ScrollViewer panel.
|
|
|
|
|
|
|
Hi,
I have a page on a windows phone 7 app, that I want to be able to click to specific button say a "Message" button and it would navigate to the Message panorama item on another panorama page.
How would I go about navigating to a specific panorama item?
Thanks
|
|
|
|
|
Anyone know how to style a Telerik RadRadioButton so that it works like MS Office Ribbon buttons? When you select a button, or hover over it, I want to see the button's gradient color and border. When not selected or hovered over, I want to button to not show the effect.
Telerik's help isn't too helpful. Google didn't help either.
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
You just need to modify the control template and add a MouseOver trigger the same as you would any other control. If they don't give you the XAML templates, you can dump them out with Blend.
|
|
|
|
|
OK - and I though this one was going to be easy!
I want a text box in a WPF form into which the user can enter a currency amount (e.g. $12.34)
I want to be able to give them an error message if they type in rubbish (e.g. "freds cash")
I want to be able to validate for ranges (so they can't for example, enter -ve numbers )
My 1st thought was to bind a standard textbox to my data property, which is a Decimal?, which doesn't work very well, as if the user types rubbish, an exception is thrown which (as far as I can ascertain) I can't catch!) I know I can display an error message/highlight the control if this happens, but this means that what is shown on the screen doesn't match what is in the property that I'm binding to - so what happens if the user now clicks the SAVE button? it saves the 'old' value, not what's on the screen, that's what!
Solutions I have seen include only binding to strings, and then validating the user input in the setter of those strings. Josh Smith does this here[^] While I like this idea, I feel a little uncomfortable - I'd really like to bind to the 'real' data and not a string representation of it.
Other solutions I came across included karl's solution here[^] which looks very interesting.
But I figure, WPF has been around for a while, so surely there's some accepted way of entering monetary amounts?
Am I missing something really obvious, so obvious that nobody's blogging about it? Or, am I just crap at Googling? Or, do I need to look at Josh or Karl's solution and use one of them? Or, is there a better way?
|
|
|
|
|
You need an attached behavior for this. I wrote one for Goldlight that effectively looks like this:
namespace Goldlight.Behaviors
{
using System.Windows;
using System.Windows.Interactivity;
using System.Windows.Input;
using System.Windows.Controls;
using System.Text.RegularExpressions;
public class NumericTextBoxBehavior : Behavior<TextBox>
{
#region Overrides
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.PreviewTextInput += AssociatedObject_PreviewTextInput;
DataObject.AddPastingHandler(AssociatedObject, OnClipboardPaste);
}
protected override void OnDetaching()
{
AssociatedObject.PreviewTextInput -= AssociatedObject_PreviewTextInput;
DataObject.RemovePastingHandler(AssociatedObject, OnClipboardPaste);
}
#endregion
#region Private Methods
private void AssociatedObject_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
var tb = AssociatedObject;
e.Handled = !Validate(e.Text);
}
private void OnClipboardPaste(object sender, DataObjectPastingEventArgs e)
{
var tb = sender as TextBox;
string text = e.SourceDataObject.GetData(e.FormatToApply) as string;
if (!string.IsNullOrEmpty(text) && !Validate(text))
{
e.CancelCommand();
}
}
private bool Validate(string newContent)
{
TextBox tb = AssociatedObject;
string testString = string.Empty;
string pre = string.Empty;
string post = string.Empty;
if (!string.IsNullOrEmpty(tb.SelectedText))
{
pre = tb.Text.Substring(0, tb.SelectionStart);
post = tb.Text.Substring(tb.SelectionStart + tb.SelectionLength,
tb.Text.Length - (tb.SelectionStart + tb.SelectionLength));
}
else
{
pre = tb.Text.Substring(0, tb.CaretIndex);
post = tb.Text.Substring(tb.CaretIndex, tb.Text.Length - tb.CaretIndex);
}
testString = pre + newContent + post;
Regex regExpr = new Regex(@"^([-+]?)(\d*)([,.]?)(\d*)$");
return (regExpr.IsMatch(testString));
}
#endregion
}
} The full Goldlight version does quite a bit more with the regex, but this basic logic holds. Now, all you need to do is attach this to your TextBox .
|
|
|
|
|
Right, the way I've implemented this in Goldlight is shown in this blog entry[^].
I'm not a stalker, I just know things. Oh by the way, you're out of milk. Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Onyx
modified on Wednesday, March 30, 2011 3:40 PM
|
|
|
|
|
I don't quite know how to reply without sounding as if I have a man-crush on you.
Just looking at the string.Format pattern made my eyes look like those of the snake in The Jungle Book movie!
Thanks!
|
|
|
|
|
No problem. Glad I can help.
|
|
|
|
|
I have a Gridview where i bind the list of values from my model. Now i have a bit field from the DB and it represents yes or no, or true or false using 1 and 0. Now i want to bind this to a Checkbox column and below is what i have
<telerik:GridViewCheckBoxColumn AutoSelectOnEdit="True" DataMemberBinding="{Binding sIsMain,Mode=TwoWay}"></telerik:GridViewCheckBoxColumn>
and it give me an Error when i run it.
SCRIPT5022: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at System.Windows.ResourceManagerWrapper.GetResourceForUri(Uri xamlUri, Type componentType)
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
modified on Wednesday, March 30, 2011 4:18 AM
|
|
|
|
|
The problem's not quite the one you think it is. Basically the exception is telling you that the resource wrapper failed to get resource styling at System.Windows.ResourceManagerWrapper.GetResourceForUri(Uri xamlUri, Type componentType). The reason for this is unrelated to styling altogether. Basically, you are using a byte to represent a boolean condition, so I'd look at either converting the value to a boolean beforehand or converting the byte with a value converter:
namespace MyConverters
{
using System;
using System.Windows.Data;
public class ByteToBooleanConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
byte conv = (byte)value;
return conv == (byte)1;
}
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
}
|
|
|
|
|
Thank you for your reply. i have converted the Model to give me a Boolean , but the Database is kept untouched and its working fine.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Good job
|
|
|
|
|
I check on the Internet - and i actually try anything i found ... and still nothing work.
I have simple server that i wrote using WCF ( .net 4.0 ) and simple silverlight ( .net 4.0 ) application that use this WCF service.
Both of them are on the same sulotion.
I want to use the IIS ( 7.5 ) - so in compiling i define the visual studio to 'use local IIS web server'.
Now, when i testing my silverlight apps on debug - i see that all work fine ( the WCF service call work fine ).
But when i ran it directly from the explorer i see that i get message about that the silverlight app. can't call the WCF service.
( cross-domain problem )
The exception error is:
An error occurred while trying to make a request to URI ‘http://localhost/MyService’. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details.
I try to add clientaccesspolicy.xml and crossdomain.xml file to the WCF folder ( the folder that contain the .cvs file )
I try to add clientaccesspolicy.xml and crossdomain.xml file to the WCF folder that contain the interface contract files.
But still nothing work.
I still get the same exception message.
Is there some code example to see how to do it right ?
|
|
|
|
|
You need to locate the clientaccesspolicy.xml file in the root of the domain that you intend to serve the data from. So, if you were hosting it as http://localhost/MyApplication/MyService.xml, the policy would be http://localhost/clientaccesspolicy.xml and not http://localhost/MyApplication/clientaccesspolicy.xml.
Note: Similar logic applies to the crossdomain.xml file.
|
|
|
|
|
I can access to http://localhost/clientaccesspolicy.xml
The clientaccesspolicy.xml is
<br />
<br />
<?xml version="1.0" encoding="utf-8" ?> <br />
- <access-policy><br />
- <cross-domain-access><br />
- <policy><br />
- <allow-from http-request-headers="*"><br />
<domain uri="*" /> <br />
</allow-from><br />
- <grant-to><br />
<resource path="/" include-subpaths="true" /> <br />
</grant-to><br />
</policy><br />
</cross-domain-access><br />
</access-policy><br />
<br />
and still nothing help.
|
|
|
|
|
What about your crossdomain.xml? What happens if you browse to http://localhost/crossdomain.xml?
|
|
|
|
|
I can see the crossdomain.xml also when i try to enter
http://A.B.C.D/crossdomain.xml
from explorer - from different machine ( A.B.C.D is the server machine IP )
|
|
|
|
|
The first thought I have is that perhaps SOAPAction has been blacklisted. In the section
<allow-from http-request-headers="*"> change this to <allow-from http-request-headers="SOAPAction"> instead.
|
|
|
|