Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
sir ! i have written this code in c# xaml !
--------------------------------------------------
<window x:class="dynamic_resources.MainWindow" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="Gradient sample" Height="350" Width="525" removed="{DynamicResource windowsBackgrounBrush}"> //warning about this line!
<window.resources>
<sys:string x:key="ComboBoxtitle" xmlns:sys="#unknown">items
<x:arrayextension x:key="ComboBoxItems" type="sys:String">
<sys:string xmlns:sys="#unknown">Item#1
<sys:string xmlns:sys="#unknown">Item#2
<sys:string xmlns:sys="#unknown">Item#3

<lineargradientbrush x:key="windowsBackgroundBrush"> <gradientstop offset="1" color="Gray">
<gradientstop offset="2" color="silver">

<stackpanel margin="10">
<Label Content="{StaticResource ComboBoxtitle}"/>
<combobox itemssource="{StaticResource ComboBoxItems}">



------------------------------------------------
this is working fine but there is not any gradient effect is not displayed !
it is showing a warning:

Warning 1 The resource "windowsBackgrounBrush" could not be resolved. c:\users\tushar\documents\visual studio 2012\Projects\dynamic_resources\dynamic_resources\MainWindow.xaml 5 58 dynamic_resources
.
Posted
Comments
tusharkaushik 2-Sep-14 14:09pm    
how can i resolve this!
Sergey Alexandrovich Kryukov 2-Sep-14 14:18pm    
Not clear. To use resources, add resource dictionary. Ah, probably you already do.
Anyway, this code sample does not show a problem. You need to create different, short and comprehensive code sample, not all your code.
—SA
[no name] 2-Sep-14 14:30pm    
The error message is clear. You resolve this by defining a resource named windowsBackgrounBrush
Sergey Alexandrovich Kryukov 2-Sep-14 15:27pm    
This is the answer. :-)
—SA
[no name] 2-Sep-14 20:51pm    
FYI, spelling counts in coding. If you look at your actual code, you would see that the resource is defined as windowsBackgroundBrush not windowsBackgrounBrush

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900