|
GREAT!
thank you very much.
I hate these simple things. was looking for some complex answer..
anyway. it worked.
thanks.
|
|
|
|
|
What's in your App.xaml? Do you have a StartupUri declared there? If so, remove it.
"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
|
|
|
|
|
|
I opened up a reply to message then got distracted by a client phone call. By the time I posted my answer, Jammer had posted his, so it's good.
"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
|
|
|
|
|
Hello All,
I am very much new to .Net. I am trying to load a project, but it is showing up an error message, like
" The Project file 'D:\...\...\Silverlight\....Silverlight.csproj' can not be opened. The project type is not supported by this installation. "
Can anyone tell why I am getting this error.
I have installed Microsoft visual Studio 2008, Silverlight 3 Toolkit November 2009.
Thanks in Advance...
|
|
|
|
|
|
Thanks for the reply..
It worked..
|
|
|
|
|
I'm in a WPF app, and I want to add controls to a grid at runtime. I have:
private void LoadView(ViewModelBase View)
{
Type ViewType = View.GetType();
switch (ViewType.Name.ToLower())
{
case "groupviewmodel":
CurrentView = new GroupViewModel();
CurrentControl = new crlGroupView();
break;
case "ruleviewmodel":
CurrentView = new RuleViewModel();
CurrentControl = new crlRuleTree();
break;
}
CurrentControl.DataContext = CurrentView;
grdMain.Children.Add(CurrentControl);
Grid.SetRow(CurrentControl, 1);
Grid.SetColumn(CurrentControl, 0);
grdMain.Children.Add(CurrentControl);
}
The control does not appear. Anyone know what's wrong?
Everything makes sense in someone's mind
|
|
|
|
|
Hi,
don't know, if this one's still open, but if so, I can give you two hints:
1. your code isn't working. You can't add one control two times (results in an ArgumentException)
2. if you replace the beginning of your method (I mean everything until but not including "Grid.SetRow(...") with
Button CurrentControl = new Button();
CurrentControl.Content = "Hello World";
the Button shows up as expected and everything here is fine. The error your seeking seems to lurk in the code not provided.
Cheers
Jürgen
|
|
|
|
|
There are a lot of articles out there about MVVM, and most of them are so incredibly vague that they border on uselessness.
After several Silverlight projects, I realized that there is no MVVM on Silverlight!
Here's why:
There is no Model in a Silverlight app. The Model exists in the Service layer (i.e. your Asp.NET project that feeds or processes web service calls from your Silverlight app). There are no business objects (i.e. models) in a Silverlight app!
Really what you have in your Silverlight app, are DTOs (Domain Transfer Objects) which you receive from web service calls. Those are then mapped to ViewModels, and displayed by the View. In addition, you probably have service layer proxies, and perhaps mediator classes (i.e. Controllers) that wire up the ViewModels, Views, and Service layer proxies.
The pattern should be renamed DCVVM: DTO - Controller - View - ViewModel. Or rearrange the letters as you see fit
Just my little rant of the day...
modified 26-Apr-21 21:01pm.
|
|
|
|
|
aemami99 wrote: There is no Model in a Silverlight app. The Model exists in the Service layer (i.e. your Asp.NET project that feeds or processes web service calls from your Silverlight app). There are no business objects (i.e. models) in a Silverlight app!
True.
However, the model is from the UI perspective - tmrw, you could change your Asp.net with a WCF one and hopefully, the SL model will not change.
Just my two cents....
modified on Monday, May 10, 2010 10:47 PM
|
|
|
|
|
Hello,
I’m about to develop an application, I have almost everything sorted out but there is one thing I really can’t analyze and this is why I decided to ask it here, CodeProject is a huge source of knowledge (not always though :P), and I hope someone will enlighten me, so here it is.
I will simplify the problem since it would take a considerable time to explain it fully.
I need to display a surface (on the screen) where I will drag objects over it. Objects will be allowed on almost all of the surface and only some parts will block dragging. Since almost all of the surface is an ‘available zone’ I can’t imagine analyzing each pixel and see if I still can place my object there for each movement, that would be a performance killer (keep in mind that I will display approximately 100 objects or more, it could grow up to 500, I don’t think more than that). I will start from there, I don’t want to make early specifications so if anyone is interested in helping or just giving an opinion, I’d be glad. I will just say a couple things, I was planning to do this using Silverlight 4 and I saw a ‘Collision detection algorithm’ which may be useful.
Thanks.
|
|
|
|
|
Without knowing what the rest of your architecture is, I'd suggest that all you need do is position panels at the position that you want to disallow the drop and use those to determine the applicability of the operation.
"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
|
|
|
|
|
Thanks,
Since I don’t have much spare time outside work I didn’t had the chance to read about Silverlight, I don’t pretend to find the solution to my problem all worked out here, just ideas that might point me in the correct direction. But… could you explain me how panels could help me and how do you suggest I should use them?
The areas might have strange forms (rounded, triangular, or anything actually), so it’s not just about placing a flat squared panel, I also have to take in consideration the height of the section where I’m dragging the object, not all the surface will have the same height, that’s where I think it might become tricky. I don’t know Silverlight panels, if I can give them any form using coordinates or something similar it could be though.
Thanks again.
|
|
|
|
|
A set of drag drop API's are available in Silverlight 4 - these may be of some interest to you.
You might also want to have a look at the drag drop manager.
|
|
|
|
|
Thank you,
I'll take a look at this tonight and see if it could work for me.
Thanks again.
|
|
|
|
|
Hello
I have a question and was hoping that someone could help me. I am not too sure how to approach it.
Basically all i want to do is to change the colour of an object based on a bound value. Not only do i want the colour to change based on a bound value but for certain values i want the colour to flash also.
I have a class that I have developed that inherits framework element, i then override the onrender method to draw my object. For example a rectangle. I have a dependency property called Status of type brush which is bound using a converter. This works great for changing the colour when the bound value changes but i cannot flash the colour using this method.
I am now looking at styles and animiations to do this. but i am running into the problem of once the first animation has begun i cannot then run another animation if i am using FillBehavior="HoldEnd".
Example
<DataTrigger Value = "30" >
<DataTrigger.Binding>
<Binding RelativeSource ="{RelativeSource Self}" Path = "Width"/>
</DataTrigger.Binding>
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard >
<ColorAnimation Storyboard.TargetProperty="(Fill).(SolidColorBrush.Color)" To=" Pink" RepeatBehavior= "Forever" Duration="0:0:0.2" AutoReverse="True" ></ColorAnimation>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Value = "40" >
<DataTrigger.Binding>
<Binding RelativeSource ="{RelativeSource Self}" Path = "Width"/>
</DataTrigger.Binding>
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard >
<ColorAnimation Storyboard.TargetProperty="(Fill).(SolidColorBrush.Color)" To="Yellow" FillBehavior="HoldEnd" ></ColorAnimation>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
---
If i run the above code once my value reaches 40 and the animation begins to change the color to Yellow. I cannot then get the animation for value 30 to work.
What i want is to change the color of my object using animations. if the bound value is for example 30 i want the color to be pink, then if the value changes to 40 i then want the color to change to yellow. I understand what the fillbehaviour does but i do not want the animation to stop until the bound value has changed.
Any ideas.
Thanks
|
|
|
|
|
I've been trying to find a way to validate if a given date / time string (eg 01/02/2008 for a date) is a valid date string or time string. I was looking for a toolkit that can automatically do this for any culture in .net, accounting for the different cultures' date and time formats.
I've looked into the DateTime.TryParse method. This method will account for different cultures and their respective date formats, and it will return a boolean indicating whether it was able to interpret a date. However, it's much too forgiving - if you leave out a year it will add a year itself and return true for a valid conversion.
Is there a class in the .net libraries that will do this for me? If not, does anyone know of a robust library I could download that already has this functionality?
|
|
|
|
|
datahead wrote: Is there a class in the .net libraries that will do this for me? If not, does anyone know of a robust library I could download that already has this functionality?
I had faced the same problem and could not find a solution on the internet.
My database returns 01/01/01 as the null date and .Net's TryParse converts it to 01/01/2001 which is a valid date. The fixed that I finally implemented was to add an additional if condition to check 01/01/01 and treat such a date as null.
The minimum default year is specified in the Control Panel's regional settings option. In XP or Vista I was unable to change this date - not sure about Windows 7.
|
|
|
|
|
I am using the WPF ListView, with an embedded GridView, to display a table of data. When the scroll bar is present, I would like to slightly increase the scrollable height of the list, making a little more visible white space at the end of the list.
Note, I do NOT want to accomplish this by adding additional empty rows to the list.
Any ideas on how to accomplish this?
Thanks,
Aaron Stibich
|
|
|
|
|
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
|
|
|
|
|