Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys.

i was searching in google how to bind expander texblock found this article http://stackoverflow.com/questions/3388138/wpf-datagrid-group-expander-text-how-to-bind it is what i was looking for... but problem is that i dont know how i can use this : <local:GroupingName x:Key="GroupingName"/> where i must place this in my xaml

i know this is very stupid question but im new in wpf. :)
any advice would be ver helpful for m
Posted

You need to place this in <Window.Resources>. This also assumes you have created a namespace called local in your window that refers to the namespace that holds your class . Something like this

XML
<Window x:Class="yourClass.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Height="300" Width="300"
        xmlns:local="clr-namespace:Models;assembly=Models" >
    <Window.Resources>
        <local:GroupingName x:Key="GroupingName"/>
    </Window.Resources>
    <Grid>

    </Grid>
</Window>


Hope this helps

By the way

lester555 wrote:
this is very stupid question


There is no such thing as a stupid question. Only stupid answers. Rather just ask :)
 
Share this answer
 
v2
Comments
lester555 30-Aug-11 5:14am    
thank you very much for replay but when i write in user.control resources vs gives exception: The type 'local:GroupingName' was not found.
Wayne Gaylard 30-Aug-11 5:19am    
Did you declare the namespace of your class in your USerControl declaration

xmlns:local="your namespace which contains GroupingName" ?
lester555 30-Aug-11 5:27am    
Im trying to do that. My user control name is logistic and Grouping Name is inside logistic and project name is H_Pro. how i can declare it? sorry for such questions....
Wayne Gaylard 30-Aug-11 6:50am    
Sorry, got stuck in a meeting. You need to check at the top of your xaml file, and you will see something to the effect of x:Class="something or other". Just type xmlns:local= and a popup should display showing various namespaces to choose from. Choose the one that corresponds to the Class declaration at the top.
lester555 30-Aug-11 7:20am    
big thanks to you ive done
GroupingName appears to be a class, so it can be anywhere in the application.
local represents a namespace and will be defined at the top of the xaml.
 
Share this answer
 

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