|
Hey,
Looking for some help on Binding to the selectedDates property of the calendar control.
I have an observable collection of my own appointments objects and this class has a date property. So I want the calendar control to show all the dates from the observable collection. Not sure how to do this. I know how to manually set the dates in the calendar control and they show up with the light blue box around them.
If anyone could point me in the right direction that would be great
Thanks
|
|
|
|
|
|
I'm working with .net 4.0.
So its basically saying that I cant actually bind to the SelectedDates property and have to do the work in the code behind.
|
|
|
|
|
Hi all,
I checked the validation for my form by using DataAnnotations.
<br />
[Required(ErrorMessage="User Name is Required")]<br />
[StringLength(12,MinimumLength=6,ErrorMessage="User Name must be in between 6 to 12 Characters")]<br />
public string UserName<br />
{<br />
get { return _UserName; }<br />
set <br />
{<br />
<br />
Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName="UserName"});<br />
_UserName = value; <br />
}<br />
} <br />
The error is always throwed at [Validator.ValidateProperty] and applicaton is stopped!! why on my friend's PC is not and the error message is displayed near the textbox normally.
The strange is any source code that i got from internet or from my friend's PC is run normally with DataAnotation. But when i clean project and build it again, the application always throw error ( like : value is required ... ) at Validator.ValidateProperty and application is exited ( or stop running )
How could i solve it ?
|
|
|
|
|
Hi,
I want to develop a web site in silverlight completely,It's a website for getting advertisments.
Will I encouner any problem?
I mean it is OK if develop a web site fully in silverlight
Best wishes
|
|
|
|
|
mehrdadc48 wrote: Will I encouner any problem?
What types of problem you are expecting there?
mehrdadc48 wrote: I mean it is OK if develop a web site fully in silverlight
Why not? There are several websites now fully developed in Silverlight.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
See this interesting discussion here[^].
Might give you some confidence to start developing in Silverlight.
|
|
|
|
|
OK, I'm playing with WPF MVVM
I'm using a resource dictionary to define which view to be used for which viewmodel.
e.g.
<DataTemplate DataType="{x:Type vm:ClockViewModel}">
<vw:DigitalClock/>
</DataTemplate>
then in my Window code behind I have
ClockViewModel vm1 = new ClockViewModel();
tabItem1.Content = vm1;
Sofa so good - but in this particular case I have a clock model - and I can choose either a digital or analogue view. The default in the dictionary is the digital clock.
I know I could stop using the dictionary and simply instantiate the view myself and give it a ClockViewModel as a DataSource, but I rather like the elegance of the Dictionary.
I can't figure out if it is possible to keep using the dictionary, but override the process on occasion.
Remember, I'm a WPF newbie, so if I am missing something obvious, be gentle
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
I think you can make use of template selector concept. You can create a user control with DataTemplateSelector, check property in your view model and switch between analog and digital clock usercontrols accordingly.
Try Google for some tutorials,
DataTemplateSelector WPF[^]
|
|
|
|
|
Thanks - I'm Binging it now (not really, I'm googling).
Sometimes it's just finding that right keyword...
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Googled, found, implemented and Bobn's your Uncle - thanks!
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
_Maxxx_ wrote: Bobn's your Uncle
Bob's your uncle
I guess you use DataTemplateSelector.right?
|
|
|
|
|
Arun Jacob wrote: Bob's your uncle
Actually, Bob's transgender so now Bob's your aunt.
"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'd start looking into DependencyInjection if I were you.
Maybe even Prism ...
|
|
|
|
|
Hi,
I took a class for youtube player and create a instance of that youtube player in Page3.xaml page..The issue is at runtime (F5), in the application i got the youtube video in the bottom of the page and even its there for each and every xaml pae while i am navigating..how to resolve this issue for setting the youtube video exact position where i want and stop reflecting to other pages .The code is as below:
in Class1.cs
-------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
using System.Windows.Browser;
namespace K12
{
public class YouTubePlayer : IDisposable
{
public const int DefaultWidth = 425;
public const int DefaultHeight = 344;
#region Private properties
private string uniqueId = Guid.NewGuid().ToString();
private double top;
private double left;
private double height = DefaultHeight;
private double width = DefaultWidth;
private string videoId;
private bool isEmbeded;
private HtmlElement div;
#endregion
public YouTubePlayer(string videoId)
{
this.videoId = videoId;
}
public double Top
{
get { return top; }
set
{
top = value;
if (isEmbeded)
{
SetStyleProperty(DivId, "top", "\"" + (int)top + "px\"");
}
}
}
public double Left
{
get { return left; }
set
{
left = value;
if (isEmbeded)
{
SetStyleProperty(DivId, "left", "\"" + (int)left + "px\"");
}
}
}
public double Height
{
get { return height; }
set
{
height = value;
if (isEmbeded)
{
SetAllDivsProperty("height", "\"" + (int)height + "px\"");
}
}
}
public double Width
{
get { return width; }
set
{
width = value;
if (isEmbeded)
{
SetAllDivsProperty("width", "\"" + (int)width + "px\"");
}
}
}
public bool AllowFullScreen { get; set; }
public void Embed()
{
if (isEmbeded) return;
isEmbeded = true;
div = HtmlPage.Document.CreateElement("div");
div.SetAttribute("id", DivId);
div.SetAttribute("style", "position: absolute; width:" + (int)Width + "px; height:" + (int)Height + "px; top: " + (int)Top + "px; left: " + (int)Left + "px; z-index:10");
div.SetProperty("innerHTML",
"<object width=\"" + (int)Width + "\" height=\"" + (int)Height + "\" id=\"" + ObjectId + "\">" +
"<param name=\"movie\" value=\"http://www.youtube.com/v/" + videoId + "&hl=en&fs=1\"></param>" +
"<param name=\"allowFullScreen\" value=\"" + AllowFullScreen + "\"></param>" +
"<embed id=\"" + EmbedId + "\" src=\"http://www.youtube.com/v/" + videoId + "&hl=en&fs=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"" + AllowFullScreen + "\" width=\"" + (int)Width + "\" height=\"" + (int)Height + "\"></embed>" +
"</object>"
);
HtmlPage.Document.Body.AppendChild(div);
}
public void Dispose()
{
if (!isEmbeded) return;
isEmbeded = false;
HtmlPage.Document.Body.RemoveChild(div);
}
#region Implementation
private string DivId { get { return "YouTubePlayer" + uniqueId; } }
private string ObjectId { get { return "YouTubePlayer_Object_" + uniqueId; } }
private string EmbedId { get { return "YouTubePlayer_Embed_" + uniqueId; } }
private void SetAllDivsProperty(string property, object value)
{
SetProperty(DivId, property, value);
SetProperty(ObjectId, property, value);
SetProperty(EmbedId, property, value);
}
private void SetProperty(string divId, string property, object value)
{
HtmlPage.Window.Eval("document.getElementById(\"" + divId + "\")." + property + " = " + value + ";");
}
private void SetStyleProperty(string divId, string property, object value)
{
HtmlPage.Window.Eval("document.getElementById(\"" + divId + "\").style." + property + " = " + value + ";");
}
#endregion
}
}
In Page3.xaml.cs
----------------
private void Page3_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
YouTubePlayer player = new YouTubePlayer("5_a4zb9D4m4")
{
Top = 100,
Left = 200,
Width = 400,
Height = 400
};
player.Embed();
}
Plz suggest me..Thanks in Advance
With Regards
Ch.Gayatri
|
|
|
|
|
In the WinForm days there was a lot of work done with anchoring to make controls adjust to resizing of the window.
What is the equivalent approach in WPF applications? What are best practices for scaling controls? Implement with inline code or what?
Thanks
|
|
|
|
|
HorizontalAlignment="Strech" VerticalAlignment="Strech"
This might do the job...
|
|
|
|
|
Thanks, I'll give it a try.
|
|
|
|
|
One of the great things about WPF is that you don't need this sort of thing anymore!
|
|
|
|
|
Windows Presentation Foundation (WPF) was going to hopefully usher in a new era of cool applications and user interactions.
That's why I'm learning this days about the amazing tool from Microsoft wich named "Expression Blend 4". It makes our work easier than ever to design our WPF and Silverlight apps,Particularly impressive to me is the SketchFlow feature, which enables rapid prototyping for our WPF and Silverlight applications.Meanwhile the ability to creat rich web experiences, games, desktop apps, and more.
When i Was seaching for samples or examples for a great WPF project on the web, I found some apps like http://bit.ly/9RSD1Y , http://bit.ly/bRTdYg but they are not avaible to download ,such as payante libraries like Devexpress,Infragistrics and more ..
I'm searching for first exemplar for WPF on CodePlex, to not only learn WPF but also to learn good practices for enterprise application development across the board.
|
|
|
|
|
Dear,
I think so, for any WPF learner MSDN is the best resource
find the below URL
http://msdn.microsoft.com/en-us/library/ms754130.aspx[^]
I would suggest, if you want to know best practices for specific area then go to Google.
Thanks
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
Hi All! I've started learning WPF but stuck. How could I preserve transparent background in the DataGrid->DataGridTextColumn->Cell during edit mode?
Thanks in advance!
<br />
<Style TargetType="{x:Type my:DataGridCell}"><br />
<Setter Property="Template"><br />
<Setter.Value><br />
<ControlTemplate TargetType="{x:Type my:DataGridCell}"><br />
<Border SnapsToDevicePixels="True" VerticalAlignment="Stretch" Background="Transparent" HorizontalAlignment="Stretch" BorderBrush="{TemplateBinding BorderBrush}"><br />
<ContentPresenter Name="ContentPresenter" VerticalAlignment="Center" Content="{TemplateBinding Content}" TextBlock.TextAlignment="Left" SnapsToDevicePixels="True" TextBlock.Foreground="#FF5185F2"><br />
</ContentPresenter><br />
</Border><br />
</ControlTemplate><br />
</Setter.Value><br />
</Setter><br />
</Style><br />
modified on Thursday, July 15, 2010 1:07 PM
|
|
|
|
|
I want to develop tcp socket application,forwhich want to use c++ tcp server and silverlight tcp client(web client).At server filling data in a structure and sending to the client,Is there any way to retain the values of the structure at client side?Or can i serialize the sending data as a class object in silverlight?
|
|
|
|
|
if you write your data in xml-format you will have a easy and portable solution.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
The c++ server already have a native c++ client, now we need to add a Silverlight client without any modification to the server.
The applications are biased to use minimal data transfer. so we cannot use xml ( which will also create changes in server )
Recreating the data byte-by-byte is possible at client, but we would like to know of other possible methods.
|
|
|
|