How do you color a rectangle in C# that has been declared in XAML in WPF?
There is a rectangle control in XAML. In my C# code there are times in which it would be nice to fill the background color. How does one do this?
The rectangle has a text block nested inside. The Fill works to color the whole rectangle but it also blocks out the text. On the other hand, using the stroke first colors the rectangle and I can modify the enclosed test but the rectangle does not have a boarder.
The way to do it might be to bind the Rectangle background colouur to a property and use INotifyPropertyChanged to trigger the update of the colour based on the change.
How do I bind the Rectangle background colour to a property?
"You can´t add a refernece to Telerik.Window.Controls.DataVisualistion.dll as it was not built against Silverlight runtime. Silverlight projects will only work with Silverlight assemblies"
The thing is that I have very limited rights on my computer, for every install or un-install or whatever, I have to get our IT-guys involved, and that can mean I have to wait for hours or days.
We have noticed with your chart control that when we set it so that the point labels are showing it makes the opacity of the series definition read only. Is there a way to disable this behavior or work around it so that we can change the opacity in this case? Currently we turn the opacity to 50% for all other series when the user hover’s the mouse over one of the series items in the legend. If the point labels are on and the opacity locked we are unable to do this. Any help on this matter would be greatly appreciated.
Thanks in advance
MacKenzie
We have noticed with your chart control that when we set it so that the point labels are showing it makes the opacity of the series definition read only. Is there a way to disable this behavior or work around it so that we can change the opacity in this case? Currently we turn the opacity to 50% for all other series when the user hover’s the mouse over one of the series items in the legend. If the point labels are on and the opacity locked we are unable to do this. Any help on this matter would be greatly appreciated.
Thanks in advance
MacKenzie
| <Window x:Class="radcarouseltest.MainWindow" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| Title="MainWindow" Height="350" Width="525" |
| xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> |
| <StackPanel> |
| <telerik:RadCarousel Name="carousel" FlowDirection="LeftToRight" VerticalAlignment="Center" |
| HorizontalAlignment="Center" HorizontalScrollBarVisibility="Disabled" /> |
| <Button Content="LoadImages" Click="Button_Click" /> |
| </StackPanel> |
| </Window> |
| using System; |
| using System.Collections.Generic; |
| using System.Windows; |
| using System.Windows.Controls; |
| using System.Windows.Media.Imaging; |
| using Microsoft.Win32; |
| namespace radcarouseltest |
| { |
| /// <summary> |
| /// Interaction logic for MainWindow.xaml |
| /// </summary> |
| public partial class MainWindow : Window |
| { |
| private const String ExtensionFilter = "(*.jpg)|*.jpg|(*.gif)|*.gif|(*.png)|*.png|(*.tif)|*.tif|(*.tiff)|*.tiff"; |
| private List<BitmapImage> imageList; |
| public MainWindow() |
| { |
| InitializeComponent(); |
| imageList = new List<BitmapImage>(); |
| } |
| private void Button_Click(object sender, RoutedEventArgs e) |
| { |
| OpenFileDialog dialog = new OpenFileDialog { RestoreDirectory = true, Filter = ExtensionFilter, Multiselect = true }; |
| if (dialog.ShowDialog() == true) |
| { |
| foreach (string fileName in dialog.FileNames) |
| { |
| BitmapImage myImage = new BitmapImage(new Uri(fileName, UriKind.Relative)); |
| imageList.Add(myImage); |
| updateCarousel(); |
| carousel.SelectedItem = carousel.Items[imageList.Count -1 ]; |
| } |
| } |
| } |
| private void updateCarousel() |
| { |
| carousel.Items.Clear(); |
| foreach (BitmapImage img in imageList) |
| { |
| Image myImage = new Image(); |
| myImage.Source = img; |
| carousel.Items.Add(myImage); |
| } |
| } |
| } |
| } |
| RadControls_for_WPF_2010_1_0422_DEV.msi |
| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- Differencing export generated by Altova® DiffDog® version 2010 rel. 3 (x64) Enterprise Edition - for more information please visit www.altova.com --> |
| <diff_result> |
| <diff_info comparison_mode="text_or_xml"> |
| <source_left name="C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos" uri="file:///C:/Program%20Files%20(x86)/Telerik/RadControls%20for%20WPF%20Q1%202010/Demos"/> |
| <source_right name="D:\Telerik 2\Demos" uri="file:///D:/Telerik%202/Demos"/> |
| </diff_info> |
| <file_diff location=""> |
| <changed_content> |
| <file name="app.config"/> |
| <file name="Examples_WPF.CS.csproj"/> |
| <file name="Telerik.Windows.Examples.exe.config"/> |
| </changed_content> |
| <right_content> |
| <file name="Examples_WPF.CS.5.0.ReSharper.user"/> |
| <file name="Examples_WPF.CS.csproj.user"/> |
| <file name="Examples_WPF.CS.sln"/> |
| <file name="Northwind1.designer.cs"/> <!-- ############ Here --> |
| <file name="Telerik.Windows.Examples.vshost.exe"/> |
| <file name="Telerik.Windows.Examples.vshost.exe.config"/> |
| <file name="UpgradeLog.XML"/> |
| </right_content> |
| </file_diff> |
| </diff_result> |
| <text_diff left_location="2434" right_location="3026"> |
| <right_content> |
| <line> <Compile Include="Northwind1.designer.cs"></line> |
| <line> <AutoGen>True</AutoGen></line> |
| <line> <DesignTime>True</DesignTime></line> |
| <line> <DependentUpon>Northwind.dbml</DependentUpon></line> |
| <line> </Compile></line> |
| </right_content> |
| </text_diff> |
| Find all "Global.Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString", Match case, Whole word, Subfolders, Find Results 1, "Entire Solution" |
| Matching lines: 0 Matching files: 0 Total files searched: 1105 |
| PowerGREP for "NorthwindConnectionString" |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\app.config |
| 6 <add name="Telerik.Windows.Examples.Properties.Settings.NorthwindConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DataSources\Northwind.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/> |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\DatabaseRepository.cs |
| 18 this.dataContext = new NorthwindDataContext(Settings.Default.NorthwindConnectionString); |
| 53 DataContext db = new DataContext(Settings.Default.NorthwindConnectionString); |
| 60 DataContext db = new DataContext(Settings.Default.NorthwindConnectionString); |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\DatabaseRepository.vb |
| 15 Me.dataContext = New NorthwindDataContext(Settings.[Default].NorthwindConnectionString) |
| 46 Dim db As New DataContext(Settings.[Default].NorthwindConnectionString) |
| 53 Dim db As New DataContext(Settings.[Default].NorthwindConnectionString) |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\Northwind.dbml |
| 3 <Connection Mode="AppSettings" ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename= |
| C:\_projects\wpf\Development\WPF\DataSources\Northwind.mdf;Integrated Security=True;User Instance=True" |
| SettingsObjectName="Telerik.Windows.Examples.Properties.Settings" SettingsPropertyName="NorthwindConnectionString1" |
| Provider="System.Data.SqlClient" /> |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\Telerik.Windows.Examples.exe.config |
| 6 <add name="Telerik.Windows.Examples.Properties.Settings.NorthwindConnectionString" connectionString= |
| "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DataSources\Northwind.mdf;Integrated Security=True; |
| User Instance=True" providerName="System.Data.SqlClient"/> |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\DataSources\NWindDataSet.Designer.cs |
| 5107 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 5353 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 5593 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 5894 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 6198 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 6456 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 6705 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 6982 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\DataSources\NWindDataSet.Designer.vb |
| 4955 Me._connection.ConnectionString = Global.Telerik.Windows.Examples.Properties.Settings.[Default].NorthwindConnectionString |
| 5203 Me._connection.ConnectionString = Global.Telerik.Windows.Examples.Properties.Settings.[Default].NorthwindConnectionString |
| 5463 Me._connection.ConnectionString = Global.Telerik.Windows.Examples.Properties.Settings.[Default].NorthwindConnectionString |
| 5779 Me._connection.ConnectionString = Global.Telerik.Windows.Examples.Properties.Settings.[Default].NorthwindConnectionString |
| 6082 Me._connection.ConnectionString = Global.Telerik.Windows.Examples.Properties.Settings.[Default].NorthwindConnectionString |
| 6338 Me._connection.ConnectionString = Global.Telerik.Windows.Examples.Properties.Settings.[Default].NorthwindConnectionString |
| 6604 Me._connection.ConnectionString = Global.Telerik.Windows.Examples.Properties.Settings.[Default].NorthwindConnectionString |
| 6872 Me._connection.ConnectionString = Global.Telerik.Windows.Examples.Properties.Settings.[Default].NorthwindConnectionString |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\DataSources\NWindDataSet.xsd |
| 7 <Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="NorthwindConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Public" Name="NorthwindConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.Telerik.Windows.Examples.Properties.Settings.GlobalReference.Default.NorthwindConnectionString" Provider="System.Data.SqlClient" /> |
| 12 <DbSource ConnectionRef="NorthwindConnectionString (Settings)" DbObjectName="dbo.BigOrders" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill"> |
| 44 <DbSource ConnectionRef="NorthwindConnectionString (Settings)" DbObjectName="dbo.[Order Details]" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill"> |
| 76 <DbSource ConnectionRef="NorthwindConnectionString (Settings)" DbObjectName="dbo.Customers" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill"> |
| 122 <DbSource ConnectionRef="NorthwindConnectionString (Settings)" DbObjectName="dbo.Orders" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill"> |
| 172 <DbSource ConnectionRef="NorthwindConnectionString (Settings)" DbObjectName="dbo.Invoices" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill"> |
| 210 <DbSource ConnectionRef="NorthwindConnectionString (Settings)" DbObjectName="dbo.Categories" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill"> |
| 240 <DbSource ConnectionRef="NorthwindConnectionString (Settings)" DbObjectType="Unknown" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill"> |
| 293 <DbSource ConnectionRef="NorthwindConnectionString (Settings)" DbObjectName="dbo.AddressBook" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill"> |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\DataSources\NWindDataSet1.Designer.cs |
| 5110 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 5356 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 5596 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 5897 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 6201 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 6459 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 6708 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| 6985 this._connection.ConnectionString = global::Telerik.Windows.Examples.Properties.Settings.Default.NorthwindConnectionString; |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\GridView\WPF\Performance\ServerSide\Example.xaml.cs |
| 50 context = new NorthwindDataContext(Settings.Default.NorthwindConnectionString); |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\GridView\WPF\Performance\ServerSide\Example.xaml.vb |
| 43 context = New NorthwindDataContext(Settings.[Default].NorthwindConnectionString) |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\Properties\Settings.Designer.cs |
| 31 public string NorthwindConnectionString { |
| 33 return ((string)(this["NorthwindConnectionString"])); |
| 42 public string NorthwindConnectionString1 { |
| 44 return ((string)(this["NorthwindConnectionString1"])); |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\Properties\Settings.Designer.vb |
| 31 Public ReadOnly Property NorthwindConnectionString() As String |
| 33 Return DirectCast((Me("NorthwindConnectionString")), String) |
| 41 Public ReadOnly Property NorthwindConnectionString1() As String |
| 43 Return DirectCast((Me("NorthwindConnectionString1")), String) |
| C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2010\Demos\Properties\Settings.settings |
| 5 <Setting Name="NorthwindConnectionString" Type="(Connection string)" Scope="Application"> |
| 13 <Setting Name="NorthwindConnectionString1" Type="(Connection string)" Scope="Application"> |
| TOTAL: 56 matches in 14 files (4014 other files without matches are not listed) |