|
Put a GUID in the cookie, store that GUID in your isolated storage, if they go to the page and the GUID is missing then wipe the part of the isolated storage you would have expected the user to "clear" by manually clearing it. This way you can properly clear user data, but get the benefits of using local storage instead of a cookie.
(If it's a security issue, put a key in the cookie instead of a GUID).
|
|
|
|
|
Good people,
I have a few quick questions.
1) Is it ok to use data binding and value converters in data templates defined in my resource dictionary?
2) If so, is it a bug in my expression blend that it is not allowing me to do that?
3) If I can't what is the best work-around.
Any information you provide would be greatly appreciated.
Thank,
Blitz
|
|
|
|
|
Yes you can do this. I do it all the time.
Check you converter. Your converter must be able to handle a null value being passed in without throwing an exception.
Please post your converter code.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
First, thanks for replying. I really appreciate your help.
Below is the code for my value converter:
<code>
public class DoubleToStringEventAverageDuration : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double average = (double)value;
int digits = 1;
return Constants.EventLogisticsAverageDuration + Math.Round(average, digits).ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
// Not implemented
return Constants.EmptyNumericValue;
}
}
</code>
Let me know your thoughts.
Thanks,
Blitz
|
|
|
|
|
You MUST add a null check for value before ever using it. If it's null (like when it's in the designer because there is no data) this will be a big problem.
If value is null, just return a default value that makes sense, like 0.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Thanks again,
I thought "double" couldn't be null.
So should I change it from the explicit cast and use the "as" cast then test for null?
Blitz
|
|
|
|
|
double can't, but object can, and you're casting from an object to double. Try using double.TryParse in the conversion, e.g.
double doublevalue = 0M;
double.TryParse(value, out doublevalue);
"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
|
|
|
|
|
No check if value is null. If it is return a sensible value like 0.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Thank you both. I made the corrections.
It seems, however, that Blend still won't do it. In fact, it is not even allowing me to do the databinding in templates within the resource dictionary (when I use the designer).
I figure it must be a bug with Blend.
Thanks again,
Blitz
|
|
|
|
|
Hey all,
I have done a few wpf apps now and decided to make a deployable xbap app. I am mucking around with ellipses and wanted to be able to move an ellipse in a canvas. I have done this fine using the mouse click (i.e. if clicked move ellipse right 20) but for some reason I can't handle the keyup events in the app?
Can an xbap handle page level key presses?
Thanks
Some days robin you just can't get rid of a bomb.
|
|
|
|
|
Hi
anyone please help.
I want multi lingual support for my product developing in silverlight
I read many articles from Net, but coul'd sucessfully implement it.
I am unable to read strings from Resource file and show in the different language chosen.
although I changed in InternetExplorer settings, only default language is shown(interestingly the silverlight controls' names are getting changed)
Regards,
Manju
|
|
|
|
|
|
Hi i am having a problem in silverlight datagrid.My requirement is to add a row dynamically to the datagrid and also place a custom control in the cells of the row that is added.
|
|
|
|
|
To add a row dynamically, you would typically just add an item to the collection
providing the row data. What are you using for row data?
To place a custom control in a cell, you can use a DataGridTemplateColumn.
See Defining Columns for a Silverlight DataGrid[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi i am new to silverlight.I am having a doubt.
I added two textboxes and a button.
<textbox x:name="txtFirst" grid.column="0" grid.row="0" height="20" width="50" xmlns:x="#unknown">
<textbox x:name="txtSecond" grid.column="0" grid.row="1" height="20" width="50" xmlns:x="#unknown">
So,now when i click the button,one text box should become as the child of the other.So please help me on this issue.
|
|
|
|
|
hi suresh!!!
Does it mean that u want to add text box inside Textbox??? .. Instead of that u
can use a listbox and add a text box to it...
Samir
|
|
|
|
|
No,I don't want to add a textbox inside a textbox.But i want to make it as the child to the first textbox.That means like a hierarchical structure (parent and child's).
|
|
|
|
|
That doesn't make sense.
A control that is a child of a parent control generally implies the child is
embedded in the parent.
So what are you talking about?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, I am trying to port a sample application that I found online here:
http://www.shinedraw.com/3d-illusion/flash-vs-silverlight-3d-image-space/#comment-2085
from Silverlight 2.0 to WPF. I am rather new to both Silverlight and WPF, and I am doubtlessly missing something rather obvious in this type of porting procedure. Here is a link to the project file as I modified it:
http://www.mediafire.com/?mzwmy3nmmyd
|
|
|
|
|
WTH.
I thought I wanted to help on this so I was stupid enough to go to the mediafire link.
What a spam filled crap link.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It wasn't my intention for someone to go to a spam website to download the file. Here is the link to the file on another spam free site
www.avtinconline.com/Silverlight/ImageSpace3Dwpf.zip
|
|
|
|
|
In solution explorer, right click on the images folder in the project and choose Add...
Navigate to the images folder on your hard drive and add the 20 images to the project.
Expand the images folder in solution explorer.
For each image, right click the image, choose properties, and set its build action to "Content"
Click the top image and shift-click the bottom image (select all the images), right click the
selected images, choose properties, and set the build action to "Content"
Run it.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks! Worked like a charm!!!
|
|
|
|
|
Cool
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I believe I have found an interesting quirk. I could not get the images in the
WPF application to render in the random position order as shown in the silverlight
example version. A value that in the silverlight version returns valid floating
point values, returns "NaN" in the WPF version. The calculations seem to be the
same, so how can "NaN" be returned for one but not the other? I have modified the
project so that the values of the "NaN" numbers that should be floating point values
are recorded in a file called "Errors.txt".
Go here to see the newly modified file
www.avtinconline.com/Silverlight/ImageSpace3Dwpf.zip
|
|
|
|