European Silverlight 4 & Silverlight 5 Hosting BLOG

BLOG about Silverlight 5 Hosting and Its Techologies - Dedicated to European Windows Hosting Customer

Silverlight 5 Hosting Germany - HostForLIFE.eu :: Using "ClickMode" Property for Button control in Silverlight

clock January 27, 2015 06:35 by author Peter

In this article let us see the distinctive methods for utilizing the property Clickmode for a Button Control in a Silverlight application. Of course, open the visual studio and select the Silverlight 5 project.

First let us drag 3 different Button and TextBlock controls to Stack Panel as shown below into MainPage.xaml. Here I utilized a property called "ClickMode" for all the three button controls, But the value assigned to it is diverse.

For the first button I allocated the quality Hover to the ClickMode property, It implies that the click event handler happens at whatever point the mouse is floated onto this button.

For the second button, I allocated the quality Press to the ClickMode property, It implies that the click occasion handler happens at whatever point the mouse is clicked on this catch.  For the third button I assigned the value Release to the ClickMode property, It implies that the click event handler happens at whatever point the mouse is discharged from this button.

<Button x:Name="btn1" Margin ="5" HorizontalAlignment="Left"
Foreground="Black" Width="320" Click="OnClick1"
Content="On Mouse Hover this text will appear below" ClickMode="Hover" />
<TextBlock x:Name="text1" Margin ="0,8,0,0" />
<Button x:Name="btn2" Margin ="5,5,5,5"  HorizontalAlignment="Left"
Foreground="Black" Width="320" Click="OnClick2"
Content="On Button Press this text will appear below" ClickMode="Press" />
<TextBlock x:Name="text2" Margin="0,8,0,0" />
<Button x:Name="btn3" Margin ="5,5,5,5" HorizontalAlignment="Left"           

Click="OnClick3" Width="320" Content="On Button Release this text will appear    below" ClickMode="Release"/>
<TextBlock x:Name="text3" Margin ="0,8,0,0" />

Now i am writing the code for button click events in the MainPage.xaml.cs
public MainPage()
        {
            InitializeComponent();
        }
        void OnClick1(object sender, RoutedEventArgs e)
        {
            btn1.Foreground = new SolidColorBrush(Colors.Blue);
            text1.Text = "On Mouse Hover this text will appear below.";
            text2.Text = "";
            text3.Text = "";
        }
        void OnClick2(object sender, RoutedEventArgs e)
        {
            btn2.Foreground = new SolidColorBrush(Colors.Green);
            text1.Text = "";
            text2.Text = "On Button Press this text will appear below.";
            text3.Text = "";
        }
        void OnClick3(object sender, RoutedEventArgs e)
        {
            btn1.Foreground = new SolidColorBrush(Colors.Green);
            btn2.Foreground = new SolidColorBrush(Colors.Blue);
            text1.Text = "";
            text2.Text = "";
            text3.Text = "On Button Release this text will appear below.";
        }

Just refresh it. And here is the output.

Output for the first Button looks like:

Output for the second Button looks like:

Output for the third Button looks like: 

HostForLIFE.eu Silverlight 5 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



HostForLIFE.eu Proudly Launches Sitefinity 7.3 Hosting

clock January 26, 2015 10:13 by author Peter

HostForLIFE.eu, a leading web hosting provider, has leveraged its gold partner status with Microsoft to launch its latest Sitefinity 7.3 Hosting support.

European Recommended Windows and ASP.NET Spotlight Hosting Partner in Europe, HostForLIFE.eu, has announced the availability of new hosting plans that are optimized for the latest update of the Sitefinity 7.3 hosting technology.

HostForLIFE.eu supports Sitefinity 7.3 hosting on our latest Windows Server and this service is available to all our new and existing customers. Sitefinity 7.3 offers a natural extension to all customer SharePoint workflows and wrap a compelling presentation around client core business documents. Contextual task-oriented approach to organizing documentation on any topic.

HostForLIFE.eu hosts its servers in top class data centers that is located in Amsterdam, London, Paris and Seattle (US) to guarantee 99.9% network uptime. All data center feature redundancies in network connectivity, power, HVAC, security, and fire suppression. All hosting plans from HostForLIFE.eu include 24×7 support and 30 days money back guarantee. All hosting plans from HostForLIFE.eu include 24×7 support and 30 days money back guarantee. The customer can start hosting our Sitefinity 7.3  site on our environment from as just low €3.00/month only.

Sitefinity 7.3 is a Web Content and Experience Management Platform that enables business to engage, convert and retain customers through multiple channels. Sitefinity 7.3 is the only truly mobile web content management on the market that supports all three mobile strategies out of the box – responsive design, mobile apps and mobile sites.

Sitefinity 7.3’s intuitive user interface delights both developers and business users alike, making it a more efficient environment to get more work done faster. There’s no long training required, so even new non-technical users will be up and running in no time. Because it’s built on a modern code-base, Sitefinity is best equipped to meet the long term needs of today’s expanding businesses, including tackling challenges like mobile, ecommerce, multisite management, content personalization, and so much more.

HostForLIFE.eu is a popular online Windows based hosting service provider catering to those people who face such issues. The company has managed to build a strong client base in a very short period of time. It is known for offering ultra-fast, fully-managed and secured services in the competitive market. Our powerful servers are specially optimized and ensure Sitefinity 7.3 performance.

For more information about this new product, please visit http://hostforlife.eu/European-Sitefinity-73-Hosting

About HostForLIFE.eu :
HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see http://www.asp.net/hosting/hostingprovider/details/953). Our service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, we have also won several awards from reputable organizations in the hosting industry and the detail can be found on our official website.



Silvelight 6 Hosting Germany - HostForLIFE.eu :: Using TextBox Control in Silverlight

clock January 13, 2015 07:02 by author Peter

TextBox is the basic input control for getting into data into the Silverlight 6 Application. TextBox is especially use full whenever the user wants to enter some inputs into our Silverlight application. the following points describe the various ways that of using a TextBox management in your application.

1. The fundamental way of using the TextBlock control is:

And the result looks like below:

2. Next step, if you need to have a horizontal scrollbar in your TextBox, then the code looks as follows:

And here is the output:

 

3. If you need to have a vertical scrollbar and wrap the text completely inside your TextBox, then this is the code that I used:

And this is the result of the code:


4. If you want to insert a Hardline break explicitly from the user into your TextBox, then the code looks as follows. We can do this in both XAML and C# code.

XAML Code:

C# Code:

Apart from these there are several alternative properties that you simply will use with the TextBox control in Silverlight Application.



Silverlight 5 Hosting France - HostForLIFE.eu :: Async Web Service Calls using Delegates in Silverlight

clock January 6, 2015 06:57 by author Peter

In this post, I've been using Web-Service brings in Silverlight for various years now in a group of different applications with the unwieldy async BeginGetResponse, callback, EndGetResponse syntax. It's all been working extraordinary, I joyfully have a layout for this and can bash any new service integrations pretty quickly and has not been getting in the way. For a straightforward Get request they look something like this:

public string server = "123.123.123.123";
public void GetExample()
{
    String url = "http://" + server + "/getexample";
    try
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        IAsyncResult result = null;
        result = request.BeginGetResponse(GetExampleCallback, request);
    }
    catch (Exception)
    {
    }
}
void GetExampleCallback(IAsyncResult ar)
{
    var request = ar.AsyncState as HttpWebRequest;
    var response = request.EndGetResponse(ar) as HttpWebResponse;
    using (var reader = new StreamReader(response.GetResponseStream()))
    {
        string result = reader.ReadToEnd();
        // now do something with this
    }
}

Which is all great and I typically have some extra code here to callback to a representative which can then do something, for example, show the result nonconcurrently with the regular playing around of recovering this onto the GUI string using a BeginInvoke Dispatch.
It then gets somewhat more muddled when you need to make a post ask for and need to push the XML parameters in an alternate asynch BeginGetRequestStream capacity which means you're getting callback after callback.

Simple enough, these can be packaged into a class for every Webservice work and can utilize some templating to diminish the exertion, yet's regardless it really dull. I've remain faithful to it in light of the fact that it meets expectations, I have an example and normally its not all that much inconvenience and once done means I can concentrate on the other fascinating bits of the application.

What I thought of resembles this:
using System.Threading.Tasks;

public string server = "123.123.123.123";
public void GetExample2()
{
    String url = "http://" + server + "/getexample2";
    try  
 {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        IAsyncResult result = null;
        ManualResetEvent mre = new ManualResetEvent(false);
        result = request.BeginGetResponse((cb) =>
        {
            // Callback
            using (var response = request.EndGetResponse(cb) as HttpWebResponse)
            {
                using (var reader = new StreamReader(response.GetResponseStream()))
                {
                }
            }
            mre.Set();
        }, request);
        mre.WaitOne();
  }
    catch (Exception)
    {
    }
}

Essentially this is to handle the offbeat nature. In the event that you run this in the debugger you can see the BeginGetResponse call being made. Waitone() which is the typical string stream of the operation. You can then see the debugger bounce move down to the callback. The mre.set then sets the stream to proceed in the fundamental string once the callback has completed.



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in