|
Hi All,
I had developed a Word Add-in using WPF Ribbon. The Ribbon has a button which displays a WPF Window on clicking. On running the Add-in in my machine, the window gets displayed and its runs well, but on installing the add-in in one of production machine, I am not able to see the Window. What's even more surprising is that, the code-behind the window runs but the Window UI doesn't get displayed. This is very weird and I am not able to find the solution for it.
Need your valuable solution for it.
But this problem is only with few computers, I am kind of stuck. Please help!
Thanks,
Vikas
|
|
|
|
|
Are you sure you have the proper version of .NET installed on the production machine? I'd be surprised if you aren't getting any runtime errors if its not working.
|
|
|
|
|
Well, I am also assuming the same thing, as there was a Silverlight 4.0 installed against the standard Microsoft .net 3.5 SP1 for our company. I have just uninstalled all the frameworks and trying to re-install to see if I get any luck!
Thanks,
Vikas
|
|
|
|
|
First of all, Silverlight is not installed against the standard .NET runtime. It uses it's own version - which is a stripped down CLR designed to be delivered in an efficient manner over the web. Secondly, Silverlight 4 is a subset of the .NET 4 runtime, not the .NET 3.5 one. It sounds to me like the app just isn't firing up due to missing prerequisites. Try checking the event logs to see if Office has written anything there.
|
|
|
|
|
Hi,
Im new to coding in XAML and silverlight.
I keep getting the error The Property 'Content' is set more than once.
This error came up after I added in the top stack pannel.
This is prob a very simple error to fix but I can see where I am setting the content again.
<controls:PanoramaItem Header="">
<StackPanel Height="100" HorizontalAlignment="Left" Margin="107,260,0,0" Name="stackPanel1" VerticalAlignment="Top" Width="200">
<Image Height="112" HorizontalAlignment="Left" Margin="12,184,0,0" Name="userProfilePhoto" Source="{Binding UserProfileImage}" Stretch="Fill" VerticalAlignment="Top" Width="111" />
<TextBlock Height="44" HorizontalAlignment="Left" Margin="129,184,0,0" Name="userProfileName" Text="TextBlock" VerticalAlignment="Top" Width="297" />
<Image Height="77" HorizontalAlignment="Left" Margin="350,219,0,0" Name="userProfileMood" Stretch="Fill" VerticalAlignment="Top" Width="76" />
<TextBlock Height="157" HorizontalAlignment="Left" Margin="129,219,0,0" Name="userProfileStatus" Text="TextBlock" VerticalAlignment="Top" Width="221" />
</StackPanel>
<ListBox Margin="0,150,0,0" ItemsSource="{Binding Items}" Height="402">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17" Width="432" >
<!--<Rectangle Height="100" Width="100" Fill="#FFE5001b" Margin="12,0,9,0"/>-->
<TextBlock Text="{Binding DatePosted}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" />
<TextBlock Text="{Binding PostText}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}" />
<TextBlock Text="{Binding UserText}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--Double line list with text wrapping-->
</controls:PanoramaItem>
|
|
|
|
|
You've added two pieces of content to PanoramaItem ; in other words, you've added the StackPanel and the ListBox . I assume you mean for the ListBox to be part of the StackPanel - if so, move it insided the StackPanel tags.
|
|
|
|
|
I wanted two pannels inside my PanoramaItem
The StackPannel will hold fix pre set info
The ListBox will hold a groups of info which should be listed.
somethings like that.
How would I go about doing that, so that is isnt illegal.
Am I using the wrong items?
Thanks
|
|
|
|
|
Put a Grid (Or some other kind of panel) in the PanoramaItem, and put the StackPanel and ListBox in the Grid.
|
|
|
|
|
If you aren't intending to do something like change the visibility of the StackPanel, is there any reason you need two containers? If there is, wrap the StackPanel and ListBox in any of the containers that you want, such as a Grid.
|
|
|
|
|
I guess you need to move the listbox into another PanoramaItem.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Hi I'm reading this article from MSDN regarding Message Security with a User Name Client
[^]
Two questions:
QUESTION 1 - Since no SSL, I take they don't encrypt using SSL cert but security context constructed AFTER authentication of client from server side using username+pwd? (Does it mean client send in pwd in clear text over the wire during initial exchange?! How does TLS negotiation work? What does it use as key for encryption? Server's got to publish her public key and client must know to use it to encrypt its initial transfer of username+pwd in order for initial exchange be secured. Here it says server need to expose a "Digital Certificate" (which I don't see in MSDN's diagram[^] - it's http, not https - what certificate?)
QUESTION 2 - how to check username and pwd from server side? This is how the sample set username/pwd from proxy/client side.
<br />
cc.ClientCredentials.UserName.UserName = ReturnUsername();<br />
cc.ClientCredentials.UserName.Password = ReturnPassword();<br />
But I don't see anything from server side anything which resembles this:
<br />
if(SomeRequestContext.UserName=="johndoe" && SomeRequestContext.Password=="abc123")
{<br />
IsAuthenticated = true;<br />
}<br />
From server side, I found two comes closest but no pwd and not sure if it's correct:
<br />
OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name <br />
OperationContext.Current.ServiceSecurityContext.WindowsIdentity.User <br />
Also just a thought I don't think any of this[^] guards against say IP or arp spoofing this sort of attack?
What about replay attack (capture WCF request and resend) and mimic a license authorization or transaction for example.
Thanks!
REF: http://msdn.microsoft.com/en-us/library/ms752233.aspx[^]
dev
modified on Friday, March 25, 2011 4:31 AM
|
|
|
|
|
By default, there is no authentication.
If you want authentication, they have a bunch of different ways to go. I won't go into all of them, but it sounds like you want the custom validator. In any event, most (if not all) require a cert and SSL / HTTPS. Otherwise you would send credentials over clear text which is a no-no.
For the custom validator, SecurityMode is set to "TransportWithMessageCredential" and <serviceCredentials> has a section similar to:
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="x.y.Portal.UserNamePasswordValidator, Portal" />
UserNamePasswordValidator is a class you create that derives from UserNamePasswordValidator.
Thats just scratching the surface on the implementation details, I won't go into all of them since there are a lot (as with everything in WCF), but that should give you some good buzz words to google.
EDIT:
Oh yeah, forgot about your other question...
Once you get the password validator set up, you can get the username with:
ServiceSecurityContext.Current.PrimaryIdentity.Name
|
|
|
|
|
Thanks
And regarding TLS encryption and message integrity when Message level Security via UserName client ...[^], I found the answer (WCF client uses X509 cert to encrypt, WCF server uses public key to decrypt)[^]
The exact words from MSDN[^]are:
<br />
Since in the Internet scenario the client's message is transferred to the service over plain HTTP, it is vital to protect its content (both the client's credentials and the body of the message) by encrypting it. Encryption will provide for message integrity and privacy...<br />
Once the message is decrypted, WCF will read the client's credentials from the message, authenticate the client, and allow it to access the service. The real picture is a bit more complex, because WCF also needs to secure the reply messages and callbacks from the service to the client. One of the standards WCF supports deals with setting up such a secure conversation. In fact, several calls are made before the first request message from the client to the service, where WCF on the client's side generates a temporary shared secret it passes encrypted (using the service certificate) to the service. The client and the service will use that shared secret to protect all subsequent communication between them.<br />
REF:
Common Scenario[^]
Message security with UserName client[^]
dev
|
|
|
|
|
|
Kevin Marois wrote: the content comes out as text
I found gettig the location of the images was the most finnicky requirement. This loads a horizontal wrap panel with images and caption, url comes from the database, images are stored locally.
<ItemsControl Grid.Row="1" ItemsSource="{Binding ShipList}" HorizontalAlignment="Center">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<HyperlinkButton Click="HyperlinkButton_Click" Tag="{Binding Path=ShipID}" HorizontalContentAlignment="Center" >
<Grid HorizontalAlignment="Center" >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Image Grid.Row="0" Stretch="None" Source="{Binding Path=ShipLogoUri}" />
<TextBlock Grid.Row="1" Foreground="Blue" Text="{Binding Path=Ship}" HorizontalAlignment="Center" />
</Grid>
</HyperlinkButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Not sure if that is what you are after!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Perfect! Thank you
Everything makes sense in someone's mind
|
|
|
|
|
Ok, this works great. The buttons all appear in the WrapPanel with text & images as they should, except for 2 issues:
1) I'm using telerik:RadRadioButtons. They're not acting like radio buttons now. ie - I can select one, all, or some.
2) The Command binding isn't working. Clicking the button does not get a response:
I think these problems are the result of the fact the list is dynamic and populatd at runtime. Any thoghts?
Here's the XAML:
<ItemsControl Grid.Row="1"
Grid.Column="0"
Margin="10"
ItemsSource="{Binding TemplateTypes}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<telerik:RadRadioButton Command="{Binding SelectedTemplate}"
HorizontalContentAlignment="Center"
Height="175"
Width="120">
<Grid >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Image Grid.Row="0"
Stretch="Fill"
Height="64"
Width="64"
Source="{Binding Path=ImageFile}" />
<TextBlock Grid.Row="1"
Text="{Binding Path=Caption}"
HorizontalAlignment="Center"
TextWrapping="Wrap"/>
</Grid>
</telerik:RadRadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
And the code behind:
public class mv_FileNewViewModel : _ViewModelBase
{
#region Properties
private ObservableCollection<MenuButtonData> _TemplateTypes = new ObservableCollection<MenuButtonData>();
public ObservableCollection<MenuButtonData> TemplateTypes
{
get { return _TemplateTypes; }
set
{
if (_TemplateTypes != value)
{
_TemplateTypes = value;
RaisePropertyChanged("TemplateTypes");
}
}
}
#endregion
#region Command Properties
private ICommand _SelectedTemplate;
public ICommand SelectedTemplate
{
get
{
if (_SelectedTemplate == null)
_SelectedTemplate = new RelayCommand(SelectedTemplateExecuted, SelectedTemplateCanExecute);
return _SelectedTemplate;
}
}
#endregion
#region Command Handlers
public bool SelectedTemplateCanExecute()
{
return true;
}
public void SelectedTemplateExecuted()
{
}
#endregion
#region Private Methods
private void loadTemplateTypes()
{
TemplateTypes.Add(new MenuButtonData { Caption = "Presentations", ImageFile = @"C:\Users\kmarois\Documents\My Dropbox\Raptor\Raptor\Media\Graphics\presentation_64x64.png" });
TemplateTypes.Add(new MenuButtonData { Caption = "Slides", ImageFile = @"C:\Users\kmarois\Documents\My Dropbox\Raptor\Raptor\Media\Graphics\slide_48x52.png" });
TemplateTypes.Add(new MenuButtonData { Caption = "Controls", ImageFile = @"C:\Users\kmarois\Documents\My Dropbox\Raptor\Raptor\Media\Graphics\control_72x72.png" });
TemplateTypes.Add(new MenuButtonData { Caption = "Templates", ImageFile = @"C:\Users\kmarois\Documents\My Dropbox\Raptor\Raptor\Media\Graphics\template_32x32.png" });
TemplateTypes.Add(new MenuButtonData { Caption = "Themes", ImageFile = @"C:\Users\kmarois\Documents\My Dropbox\Raptor\Raptor\Media\Graphics\theme_64x64.png" });
}
#endregion
}
Everything makes sense in someone's mind
|
|
|
|
|
It should work, unless:
1) your DataContext is not set right
2) telerik radio buttons are not using the Command interface and just using the Click event or something
Does the telerik radio button use the command when its just plopped on a form? If you use a real WPF radio button does the command handler get called?
In regards to your other issue of the radio buttons not being grouped, with the standard WPF radio buttons, you have to specifically set the group name for them to work like you expect. Its not done by tab order like in MFC anymore . So I'd expect you have to set the group name on the telerik ones as well.
|
|
|
|
|
Well, setting the groupname solved the issue of them not acting like radio buttons.
Before I implemented this template, I had the telerik:RadRadioButtons defined explicitly in the XAML, and the command was working, as was the grouping without setting the group name. So given that, I know the DC is set right.
So, I'm still not getting the Command to work right at this point.
Everything makes sense in someone's mind
|
|
|
|
|
Oh duh... I must have been smoking crack earlier...
You are inside of the DataTemplate, so {Binding} is pointing to your item, not the VM. In this case, its MenuButtonData.
Now, you wanted to be like the cool kids and use MVVM , so you made your life a lot more difficult because you can't use RelativeSource / FindAncestor to get to where the property is.
I guess you could make the command a static property and refer to it that way, but then how would the static handler get to your VM?
Or you could try use RelativeSource / FindAncestor to get to your view if it has a reference to the ViewModel and then access the property through there. However that wouldn't be proper MVVM.
Your other option (which is what I do in my code) is to subscribe to the ItemContainerGenerator messages and when the container is generated for each item, use FindName to get to the RadioButton and hook up the command then.
The simplest way is to have the command in your view, but that ain't the best MVVM and it wouldn't really jive with your VM.
Its messy any way you do it.
|
|
|
|
|
Another idea I just had was that you can add a ref to the command inside of your MenuButtonData class and then you can use simple {Binding} in your DataTemplate and your MVVM wouldn't be broken.
You *would* have a random reference to a random command in a random place, but your other options are a lot messier.
And actually, maybe a command reference inside of MenuButtonData isn't so random...
|
|
|
|
|
This may be a really dumb response (I have not used radio buttons in SL yet, let alone Teleriks) but can't you add an IsChecked property to your observablecollection and track the change event on the list?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Try your binding like this:
<telerik:RadRadioButton Command="{Binding DataContext.SelectedTemplate, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}}"
HorizontalContentAlignment="Center"
Height="175"
Width="120">
The DataContext of the items in your itemscontrol get set on the bound item, so you have to reference your itemscontrol as source.
modified on Friday, March 25, 2011 2:26 AM
|
|
|
|
|
That did it. Thank you!!!
The only question now is how to determine which RadioButton was clicked?
Everything makes sense in someone's mind
|
|
|
|
|
Its not in sender, OriginalSource, etc? That'll just get you the RadioButton though. I'm thinking one step ahead of you here... you aren't interested in which RadioButton was clicked, you are interested in which MenuItemData was selected, right? In that case, just use CommandParameter={Binding} to pass your MenuItemData into your command handler.
|
|
|
|
|