|
There may be better method, but I think this should work :
You can create a ListViewItem template, so when it's last item (specify in your underlying model, or use TemplateSelector), occupy more space but not focusable.
Something like the following :
<DataTemplate x:Key="NormalColumn1Template" >
<TextBlock Text="{Binding Text}" />
</DataTemplate>
<DataTemplate x:Key="LastColumn1Template" >
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Text}" />
<TextBlock Text="FreeSpace" Height="100" IsHitTestVisible="False" IsFocusable="False" Background="White" />
</StackPanel>
</DataTemplate>
Regards
Joseph Leung
|
|
|
|
|
I use componentone controls I have the newest/greatest version for VS2010. I am wondering why I cannot add the controls to the toolbox in Expression web I have installed them to the GAC with no luck has anyone else seen this?
Thanks,
Humble Programmer
|
|
|
|
|
I just went through the menus looking for the Visual Studio functionality that lets you refresh the toolbox, and it ain't there. It seems to me that if it's in the GAC, it should be in the toolbox. Have you tried Microsoft's Expression forums?
BTW, if they're silverlight controls, I'm pretty sure you need to use Expression Blend (or Visual Studio) to use them.
.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
|
|
|
|
|
Put a space character somewhere in your user ID. The way it is now hoses up the column in the forum thread list.
.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
|
|
|
|
|
I have a asp.net web service (as opposed to a WCF service), and I'm trying to pass a list to one of the methods from a silverlight app.
The object in the list is defined in it's own assembly, and the assembly is referenced by both the silverlight app and the web service:
public class FMSqlParameter
{
public string Key;
public object Value;
}
public FMSqlParamContainer
{
public FMSqlParameter[] array;
}
The reason I have to do that is because Silverlight doesn't allow you to use the Data namespace objects like SqlParameter . So I used the container as follows:
List<FmSqlParameter> parameters = new List<FmSqlParameter>;
parameters.Add(new FMSqlParameter("@name", 1);
FMSqlParamContainer container = new FMSqlParamContainer();
container.array = parameters.ToArray();
I have to do this because a web service method can't accept a generic collection. When I try to pass the container to the web service, I get the following error:
There was an error while trying to serialize parameter http://USAF_FM_Dashboard.org/:GetMetricData. The InnerException message was 'Type 'FMSharedLib.FMSqlParamContainer' with data contract name 'FMSqlParamContainer:http://schemas.datacontract.org/2004/07/FMSharedLib' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.
Can ayone help?
SOLUTION ======================
After trying about a dozen different ways to get this to work, I finally came up with a workaround, but it ain't pretty. I absolutely need the ability to pass a various number of different typs of parameters for the stored procedures. After dickin' around with generic lists, and casting to arrays of objects and not getting any of that to work, I've decided to pass the web service method an xml string and translate it to SqlParameters like so:
private Parameters MakeSqlParameters(string xmlData)
{
XDocument xDoc = XDocument.Parse(xmlData);
XElement root = xDoc.Element("Parameters");
Parameters parameters = null;
if (root.HasElements)
{
parameters = new Parameters();
IEnumerable<XElement> children = (from item in root.Elements() select item);
foreach (XElement value in children)
{
string paramName = value.Element("Name").Value;
string typeName = value.Element("Type").Value;
object obj = Convert.ChangeType(value.Element("Value").Value,
Type.GetType(typeName));
SqlParameter parameter = new SqlParameter(paramName, obj);
parameters.Add(parameter);
}
}
return parameters;
}
On the client side, I created a static method that created an appropriate XElement:
public static XElement MakeXmlParameter(string name, object value)
{
XElement element = new XElement("Parameter",
new XElement("Name", "@pivot"),
new XElement("Type", value.GetType()),
new XElement("Value", value));
return element;
}
It all works great now.
.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
modified on Friday, May 7, 2010 11:32 AM
|
|
|
|
|
What does FMSqlParamContainer look like? It may be obvious but you have applied the Serializeable attribute correct?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
That's one of the many things silverlight doesn't appear to support (or maybe I'm thinking xml serialization)... :/
.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
|
|
|
|
|
I posted my solution...
.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
|
|
|
|
|
You're right, it isn't pretty. I'd try a different shade of green
Thanks for posting it
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
For starters, you can have a look here. This article pretty much explains why we need KnownTypeAttribute .
AFAIK, you can use XmlSerializer in Silverlight (and the Serialize atrribute) although I have not tried it myself.
For this you need to use the SlSvcUtil tool when you are building the web service proxy.
You can then specify your parameters just like the the normal svcUtil tool.
None of my posts might solve your problem, since you are using asmx but I'm trying anyway.
|
|
|
|
|
Serialize isn't in Silverlight. I have to use DataContract. I'm working through it now. Thanks for the link
.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
|
|
|
|
|
I posted the solution I came up with...
.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
|
|
|
|
|
John Simmons / outlaw programmer wrote: I posted the solution I came up with...
Thanks for posting the solution - as you mentioned it isnt neat - but it works and thats what matters.
|
|
|
|
|
I am designing a WPF UserControl, and I'm not sure how to do part of it correctly. The main control to be consumed by the user will have three "sub-controls", that is controls that the main control composes to create the whole:
public class MainControl : UserControl {
public SubControl Sub1 {get; private set;}
public SubControl Sub2 {get; private set;}
public SubControl Sub3 {get; private set;}
}
public class SubControl : Canvas { // Can be any user control, I just happen to use a Canvas
public int Property1 {get; set;}
public string Property2 {get; set;}
}
What I would like to do is change the code so that the properties of the the SubControl's are editable in XAML. I'm aiming for something along the lines of:
<bbb:MainControl x:Name="abc">
<bbb.MainControl.Sub1 Property1="5" Property2="Hello"/>
<bbb.MainControl.Sub2 Property1="6" Property2="Goodbye"/>
</bbb:MainControl>
I have played around making the properties of SubControl DPs, as well as making each of the SubControl's DPs, but I keep getting error MC3057. The only way I have been able to get it to work is to add DPs to the MainControl for each of the properties of the SubControl, and bind them together. That's kind of ugly and scales poorly. Does anybody have any suggestions?
|
|
|
|
|
The proper syntax :
public class MainControl : UserControl {
public SubControl Sub1 {get; set;}
}
<bbb:MainControl x:Name="abc">
<bbb.MainControl.Sub1>
<SubControl x:Name="Sub1" Property1="5" Property2="Hello" />
</bbb.MainControl.Sub1>
</bbb:MainControl>
If you want to change it in run time you have to use Trigger.
For more information, please read WPF: A Beginner's Guide - Part 1 of n[^]
Regards
Joseph Leung
|
|
|
|
|
I was kind of hoping to avoid allowing a set on the SubControl properties. Allowing the consumer to change these properties would require unhooking and rehooking events, reinitializing the new property, etc. Maybe I'm just being lazy, but I was hoping that I could make the XAML manipulate the existing instances instead of creating new ones and hooking them up.
As for updating properties at run time, I would probably use code behind to update the properties.
|
|
|
|
|
This may work, but not too maintainable.
<UserControl.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames BeginTime="0:0:0" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Red" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</UserControl.Triggers>
If you going to make DependencyProperty, you can inherit from current properties
public static readonly DependencyProperty OrientationProperty =
VirtualWrapPanel.OrientationProperty.AddOwner(typeof(VirtualWrapPanelView));
Then Bind them in Xaml.
Regards
Joseph Leung
|
|
|
|
|
I have a large view model which can take several seconds to construct. The view model contains many ObservableCollections which only support changes from the UI thread. This forces me to construct the view model on the UI thread which causes the UI to hang for the duration of the construction time. It would be far nicer if I could do this on a background thread and display a progress dialog while it completes. Is there a way that I could achieve this?
Thanks for your help!
Dan
|
|
|
|
|
daniel radford wrote: Is there a way that I could achieve this?
Maybe this link can help you implement loading on a background thread.
|
|
|
|
|
That looks like just the thing.. thanks!
|
|
|
|
|
I have a silverlight 3.0 application which is a business data editor.
Up until now I've had only a single group accessing the application and that works just fine. I applied group policies to the folder the application lives in.
Now I am about to publish two editors that open the application up to two other groups. Our company is an ISO company and I have to implement security as follows:
MainProgram -- all groups have access
EditorA EditorB EditorC EditorD EditorE EditorF
RW GrpA RW GrpA RW GrpA RW GrpA RW GrpA RW GrpA
R GrpB R GrpB -- GrpB -- GrpB RW GrpB -- GrpB
R GrpC R GrpC -- GrpC -- GrpC -- GrpC RW GrpC
For the editors that group b and c do not have access to, I should be able to limit access within the menu. But does anyone have suggestions as to how I manage the readonly right for the groups in the other editors?
Thanks,
Michael
|
|
|
|
|
You will need to implement your own logic for this - AFAIK, there is no extra support in Silverlight to implement such permissions.
|
|
|
|
|
I intended to implement my own logic.
I guess I was looking for more guidance on that.
For example, how does the menu get the group the user is in?
|
|
|
|
|
LongRangeShooter wrote: I intended to implement my own logic.
One way could be to load all your permissions (to groups etc - via a web service) during logon and then display only those groups that you have access to in your menu.
|
|
|
|
|
I was running through some code today and noticed that this.Resources (resources defined in resource dictionaries, like styles and such) was EMPTY. Of course, any style I tried to load came back as null. What could I have done to cause this?
MY-FACE-IS-RED SOLUTION
=======================
I was using this.Resources instead of Application.Current.Resources .
.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
modified on Tuesday, May 4, 2010 1:49 PM
|
|
|
|