|
Hi,
How can I set a custom link for downloading silverlight if it'n not installed on clients
Best wishes
|
|
|
|
|
|
I have two project Silverlight and WCF service. When i try to call the WCF service it gives me error
An error occurred while trying to make a request to URI 'http://localhost:1554/DashboardWCFService.svc'. 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. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details
can anyone help me in this why i am getting this error.
|
|
|
|
|
|
Hi,
Yes we have placed these file below is the content of these files.
But we still get error
clientaccesspolicy
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<allow-from http-request-headers="*">
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</cross-domain-access>
</access-policy>
crossdomain
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
|
|
|
|
|
You might want to have a look here.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Thanks, article was helpful but our problem was solved by changing the binding from wshttp to basic, which confuses me why it doesnot pick the wshttp binding. does that mean that crossdomain and clienacesspolicy xml files are useless.
|
|
|
|
|
Silverlight 3 does not supoort wshttp binding right now.
Only basicHttp is supported.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
modified on Thursday, April 8, 2010 1:44 AM
|
|
|
|
|
I've created a user-control to change border of an item. It is working fine with the following code. When the control is selected, this property appears under 'Miscellaneous' tab in 'Expression Blend/Visual Studio' Properties. But, to write value for this property, I need to type "Thick" / "Thin" etc. in space there. Can I define possible values as "Thick" / "Thin"/ "Thinner"/"None", so that they appear in a 'ComboBox'? Just like it appear in 'Visibility' and others?
I guess, this is something to do with 'TypeConverter'. I am new to C# and WPF. It would be nice, if reply comes with code for this specific problem, instead of generic one.
namespace Counters
{
public partial class TestControl: UserControl
{
private string _borderType = "Thick";
public TestControl()
{
this.InitializeComponent();
}
public static readonly DependencyProperty BorderTypeProperty =
DependencyProperty.Register("BorderType", typeof(string), typeof(TestControl),
new UIPropertyMetadata("Thick", new PropertyChangedCallback(BorderTypeChangedCallBack)));
public string BorderType
{
get { return _borderType; }
set
{
_borderType = value;
if (_borderType=="Thick")
{
}
else if (_borderType=="Thin")
{
}
else if (_borderType=="Thinner")
{
}
else if (_borderType=="None")
{
}
else
{
}
}
}
static void BorderTypeChangedCallBack(DependencyObject property, DependencyPropertyChangedEventArgs args)
{
TestControl textCounter = (TestControl)property;
textCounter.BorderType = (string)args.NewValue;
}
}
}
modified on Wednesday, April 7, 2010 4:27 AM
|
|
|
|
|
Does this help?
<StackPanel>
<ComboBox Margin="5" x:Name="myComboBoxThickness" >
<ComboBoxItem Content="Thick" />
<ComboBoxItem Content="Thin" />
<ComboBoxItem Content="Thinner" />
<ComboBoxItem Content="None" />
</ComboBox>
<Border x:Name="ThisBorder" >
<Border.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=myComboBoxThickness, Path=SelectedItem.Content}" Value="Thick">
<Setter Property="Border.BorderThickness" Value="10"/>
<Setter Property="Border.BorderBrush" Value="Aqua"/>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=myComboBoxThickness, Path=SelectedItem.Content}" Value="Thin">
<Setter Property="Border.BorderThickness" Value="5"/>
<Setter Property="Border.BorderBrush" Value="Green"/>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=myComboBoxThickness, Path=SelectedItem.Content}" Value="Thinner">
<Setter Property="Border.BorderThickness" Value="2"/>
<Setter Property="Border.BorderBrush" Value="Yellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=myComboBoxThickness, Path=SelectedItem.Content}" Value="None">
<Setter Property="Border.BorderThickness" Value="0"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Text="This is a test arena!!!!!!!!!!!!" />
</Border>
</StackPanel>
|
|
|
|
|
Thanks for your reply. But here I need something related to user-control. 'BorderType' is a custom made property of that control. And this property appears in 'properties' panel along with other properties(e.g. Opacity/Visibility etc), when one selects that user-control.
Everything is fine with current code. But, I need to type the value of 'BorderType' in 'Properties' panel. I am looking for a way, where I can choose the value from combo-box.
|
|
|
|
|
Oh OK, I did something similar with a control for visibility of the Toolbar. It would be the very similar.
You need to set yourself up a public Enum for your types of Border
public enum BorderTypes
{
Thick = 0,
Thin = 1,
Thinner = 2,
None= 3,
}
Now I think this should work for you (fingers crossed)
#region BorderThicknessProperty DP
public static readonly DependencyProperty myBorderThicknessProperty =
DependencyProperty.Register("myBorderThickness", typeof(BorderTypes), typeof(TestControl),
new FrameworkPropertyMetadata(BorderTypes.Thick, new PropertyChangedCallback(OnBorderThicknessPropertyChanged)));
public BorderTypes myBorderThickness
{
get { return (BorderTypes)GetValue(myBorderThicknessProperty); }
set { SetValue(myBorderThicknessProperty, value); }
}
private static void OnBorderThicknessPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
BorderTypes ds = (BorderTypes)e.NewValue;
switch (ds)
{
case BorderTypes.Thick :
{
((TestControl)d).<Name of your control here to set the border thickness on>.BorderThickness = 10;
}
break;
}
}
#endregion
modified on Thursday, April 8, 2010 4:16 AM
|
|
|
|
|
Perfect! This works. Many thanks...
|
|
|
|
|
Even though my UserControl is larger than the screen, the browser doesn't give me any scrollbars. Why not?
Solution ==========
You have to put a ScrollViewer around the main Grid component.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi
I am trying to change the look of the ComboBox when it is disabled. I want to change it's background and border. I tried the most common aproach with triggers but that did not work. Than I tried changing the template but could not find the part that should be changed. Does anybody has a solution for my problem?
Any advice will be appreciated.
Uros
|
|
|
|
|
Try this:-
<pre>
<Style x:Key="DisabledComboBoxStyle" TargetType="ComboBox">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<Border
Grid.ColumnSpan="2"
CornerRadius="2"
Background="Red"
BorderBrush="Green"/>
<Border
Grid.Column="0"
CornerRadius="2,0,0,2"
Margin="1"
Background="Yellow"
BorderBrush="Black"
/>
<Path
Grid.Column="1"
Fill="Aqua"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 0 L 4 4 L 8 0 Z"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</pre>
In XAML:-
<pre>
<ComboBox Name="cbBox" Style="{StaticResource DisabledComboBoxStyle}" Height="35" IsEnabled="False" />
</pre>
hth,
v
|
|
|
|
|
Thanks for your reply - it works great. Maybe just one more thing. ComboBox with this style doesn't show the selected item(text) when disabled. I tried adding a TextBlock to one of the border's but I don't know to what should be bind to. Any ideas?
Thanks again for your help.
Uros
|
|
|
|
|
I have a button style resource defined (essentially, it defines the button's shape to be an ellipse instead of a rectangle). I am programatically adding a button with this style to my user control. There is no text/content on the button. This part works just fine.
When I add this button, I want to change the background color (green, yellow, red, or gray) based on a given status. How would I go about doing that?
EDIT =========
I kinda cheated. Instead of having just one style and changing the color inside it, I created foru button styles that represent the four status indicators, and pick the appropriate style in the code.
I know, it's probably not very "silverlighty", but it got me past the issue.
Still, if anyone wants to comment, be my guest.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
One way to do this would be to use a converter. You could always change the background colour based on a binding.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
As Pete suggested, you would create a ColorConverter which basically interogates the value of the bound object and sets the color based on that value.
In your XAML you would have
background="{Binding Status, Converter={StaticResource foregroundConverter}}"
And the color converter code would be something like this:
public class CodeToBackgroundColorConverter : IValueConverter
{
public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{
Color c;
int i = 0;
if ( value != null && int.TryParse( value.ToString( ), out i ) )
{
switch ( i )
{
case 1:
c = Colors.White;
break;
case 2:
c = Colors.Orange;
break;
default:
c = Colors.White;
break;
}
}
else
c = Colors.White;
return new SolidColorBrush( c );
}
public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{
return Colors.White;
}
}
|
|
|
|
|
hello to all.
I am trying add component Toolkit(Chart). But I am getting Following error.
I was tried FrameWork 3.5 and 4.0 both tool but same error is coming
There was an error loading types from assembly 'Path\WPF Toolkit.dll"\r\n'Could not load type 'System.Windows.Controls.Primitives.MultiSelectior' from assembly 'PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.\r\n\r\n
Regards,
Nanda
|
|
|
|
|
I have an application built in vs2008 using .net3.5 sp1 on a Windows 7 box. On the build machine, everything works like a charm. However, when I install it on an XP machine, the menu's behave improperly.
The observed behavior is that when a menu is opened and the mouse moved over the menu items, the first menu item that the mouse enters, stays visible, while the rest of the menu disappears. Its very strange. It looks like the menu item that the mouse is over is just a floating button. The item can be clicked and it works, but the other menu items (and their enclosing panel) are gone. Moving the mouse up or down does not "recover" the other menu items. Using keyboard cursers produces the same strange behavior.
My app is large enough that there could be plenty of coding errors, so I built a simple app to test the issue. It shows the same odd behavior. The simple app is a default WPF project with:
<DockPanel LastChildFill="True">
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File">
<MenuItem Command="{x:Static c:Window1.OpenCmd}" />
...
</MenuItem>
</Menu>
<StackPanel>
<TextBlock Text="Here" />
</StackPanel>
</DockPanel>
added to the window1.xaml and:
bool isOpen=false;
public static readonly RoutedUICommand OpenCmd = new RoutedUICommand("_Open", "Open", typeof(Window1));
public Window1() {
InitializeComponent();
CommandBinding cb = new CommandBinding(OpenCmd, exe, can);
CommandBindings.Add(cb);
}
void CanOpen(object sender, CanExecuteRoutedEventArgs e) {
e.CanExecute = !isOpen;
e.Handled = true;
}
void CanClose(object sender, CanExecuteRoutedEventArgs e) {
e.CanExecute = isOpen;
e.Handled = true;
}
added to the window1.xaml.cs.
I've simplified the xaml & c# code to only show 1 command, but obviously the error is only visible when with several items in the menu.
The Windows XP machine is a fully updated XP box (sp3 with .net 3.5sp1) that has been cleanly installed. It is running under VMWare 6.5, which I suppose opens a number of potential issues, but I run a heck of a lot of apps under vm's and haven't had any noticable issues.
Any suggestions would be greatly appreciated.
|
|
|
|
|
Looks like it might be a hardware acceleration and video driver issue. Disabling DirectX 9c for the vm's video solved the problem. I suppose it could be an issue in WPF's device capabilities and software emulation functionality as well.
|
|
|
|
|
I have a dynamically created image control in my application and want to add a Context menu to it. The following code does show the menu on right click, but does not show any of the menu itmes. Any ideas? I know it is something pretty simple, but hey i am new.
thanks for any help
Scott
ContextMenu mainMenu = new ContextMenu();
mainMenu.Height = 300;
mainMenu.Width = 200;
MenuItem imgCopy = new MenuItem();
imgCopy .Width = 50;
imgCopy .Height = 25;
imgCopy .Header = "Copy";
imgCopy .Foreground = Brushes.Black;
mainMenu.Items.Add(itemCover);
imgControl.ContextMenu = mainMenu;
|
|
|
|
|
If you put the code in imgControl.ContextMenuOpening, you should be able to make this work. You don't need to size the main menu or its children WPF should measure and display correctly.
|
|
|
|