European Silverlight 4 & Silverlight 5 Hosting BLOG

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

European Silverlight 5 Hosting - UK :: Style Setters with Silverlight 5

clock November 17, 2014 07:12 by author Scott

One of new Silverlight 5 feature is Style Setter. This great feature was heavily missing from the earlier Silverlight version. The functionality is pretty useful and is extensively used in WPF applications.

Implementing MVVM scenarios with controls inherited from ItemsControls is not an easy way and sometimes may require a lot of work.

Say binding IsSelected on C1TreeView or binding GroupName/HeaderBackground in C1Menu. There are lot of workarounds to these scenarios.

Setting binding in Style Setters is really helpful in these scenarios and it does reduces a lot of work.

Lets see this by an example. Below are the simple classes that we will be using for binding purposes:-

public class Parent
  {
    public string Name{get;set;}
    public List<Child> Childs{get;set;}
    public bool IsSelected { get; set; }
  } 

 public class Child
  {
   public Child(string name)
    {
     this.Name=name;
    }
   public string Name{get;set;}
   public bool IsSelected { get; set; }
  }

Lets populate the collection in our ViewModel:-

public class MyViewModel
  {
   private List<Parent> _collections;
   public MyViewModel()
    {
     _collections = new List<Parent>();
     _collections.Add(new Parent() { Name = "P1", Childs = new List<Child>() { new Child("C11"){IsSelected=true} , new Child("C12"), new Child("C13") } });
     _collections.Add(new Parent() { Name = "P2", IsSelected=true, Childs = new List<Child>() { new Child("C21"), new Child("C22"), new Child("C23") } });
     _collections.Add(new Parent() { Name = "P3", Childs = new List<Child>() { new Child("C31"), new Child("C32"), new Child("C33") } });
     } 

   public List<Parent> Collections
     {
      get
        {
         return _collections;
        }
      }
    }

Next is important xaml that shows the entire binding stuff in xaml:-

<c1:C1TreeView ItemsSource="{Binding Collections}" Grid.Row="1">
 <c1:C1TreeView.ItemTemplate>
 <c1:C1HierarchicalDataTemplate ItemsSource="{Binding Childs}">
 <TextBlock HorizontalAlignment="Stretch" Margin="2" Text="{Binding Name}"/>
 </c1:C1HierarchicalDataTemplate>
 </c1:C1TreeView.ItemTemplate>
<c1:C1TreeView.ItemContainerStyle>
 <Style TargetType="c1:C1TreeViewItem">
 <Setter    Property="IsSelected" Value="{Binding IsSelected}"/>
 </Style>
 </c1:C1TreeView.ItemContainerStyle>
</c1:C1TreeView>

As you can see from the above xaml code, we have used the ItemContainerStyle and bound theIsSelected property on the C1TreeViewItem with the IsSelected property exposed on our class. That was pretty simple. Isnt It?

With earlier versions, you may have to use some helper classes like SetterValueBindingHelper to achieve the same thing.

You can set similar type of styles to most of the controls inherited from ItemsControl like C1Menu,C1Accordion, C1Book etc.  while still obeying the rules of standard MVVM.

The things doesn’t stop here. With this new feature, its pretty easy to bind the C1DataGrid’s row /cell background/foreground/fontweight etc. all in xaml without manually setting the properties in code. See below xaml code which binds the IsAvailable property on the bound item toDataGridRowPresenters Background/Fontweight:-

<Style x:Key="myrowstyle" TargetType="c1:DataGridRowPresenter">
 <Setter  Property="Background" Value="{Binding RelativeSource={RelativeSource Self}, Path=Row.DataItem.IsAvailable, Converter={StaticResource BackgroundConverter}}"/>
 <Setter  Property="FontSize"  Value="{Binding RelativeSource={RelativeSource Self}, Path=Row.DataItem.IsAvailable, Converter={StaticResource FontweightConverter}}"/>
 </Style>

 



HostForLIFE.eu Windows Hosting Proudly Launches New Data Center in Paris (France)

clock November 10, 2014 10:56 by author Peter

HostForLIFE.eu, a leading Windows web hosting provider with innovative technology solutions and a dedicated professional services team proudly announces New Data Center in Paris (France) for all costumers. HostForLIFE’s new data center in Paris will address strong demand from customers for excellent data center services in Europe, as data consumption and hosting services experience continued growth in the global IT markets.

The new facility will provide customers and our end users with HostForLIFE.eu services that meet in-country data residency requirements. It will also complement the existing HostForLIFE.eu. The Paris (France) data center will offer the full range of HostForLIFE.eu web hosting infrastructure services, including bare metal servers, virtual servers, storage and networking.

HostForLIFE.eu expansion into Paris gives us a stronger European market presence as well as added proximity and access to HostForLIFE.eu growing customer base in region. HostForLIFE.eu has been a leader in the dedicated Windows & ASP.NET Hosting industry for a number of years now and we are looking forward to bringing our level of service and reliability to the Windows market at an affordable price.

The new data center will allow customers to replicate or integrate data between Paris data centers with high transfer speeds and unmetered bandwidth (at no charge) between facilities. Paris itself, is a major center of business with a third of the world’s largest companies headquartered there, but it also boasts a large community of emerging technology startups, incubators, and entrepreneurs.

Our network is built from best-in-class networking infrastructure, hardware, and software with exceptional bandwidth and connectivity for the highest speed and reliability. Every upstream network port is multiple 10G and every rack is terminated with two 10G connections to the public Internet and two 10G connections to our private network. Every location is hardened against physical intrusion, and server room access is limited to certified employees.

All of HostForLIFE.eu controls (inside and outside the data center) are vetted by third-party auditors, and we provide detailed reports for our customers own security certifications. The most sensitive financial, healthcare, and government workloads require the unparalleled protection HostForLIFE.eu provides.

Paris data centres meet the highest levels of building security, including constant security by trained security staff 24x7, electronic access management, proximity access control systems and CCTV. HostForLIFE.eu is monitored 24/7 by 441 cameras onsite. All customers are offered a 24/7 support function and access to our IT equipment at any time 24/7 by 365 days a year.

For more information about new data center in Paris, please visit http://hostforlife.eu/Paris-Hosting-Data-Center

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

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.



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