This question is locked. New answers and comments are not allowed.
I have a basic control that will be used in different areas. It has a couple of toolbars on it. I need to be able to add buttons to the toolbars in the control later on and I can do this right now no problem through code.
What I would like to be able to do is add the buttons in the XAML file like so
| <Controls:SomeControl Name="smartList" ToolbarTopVisibility="Collapsed"> |
| <Controls:SomeControl.Toolbar1> |
| <Button Name="_addButton" Margin="0,5,0,0" Click="AddButtonClick" |
| Content="{Binding Path=ApplicationStrings.Add, Source={StaticResource ResourceWrapper}}"/> |
| <Button Name="_editButton" Margin="0,5,0,0" Click="EditButtonClick" |
| Content="{Binding Path=ApplicationStrings.Edit, Source={StaticResource ResourceWrapper}}"/> |
| <Button Name="_deleteButton" Margin="0,5,0,0" Click="DeleteButtonClick" |
| Content="{Binding Path=ApplicationStrings.Delete, Source={StaticResource ResourceWrapper}}"/> |
| </Controls:SomeControl.Toolbar1> |
| </Controls:SomeControl> |
as shown below, by adding a property ( Toolbar1 ) to my Control and returning the Items in the RadToolBar I am able to have the above code working, events fire and everything in general works just as you would expect.
| public class SomeControl |
| { |
| public SomeControl() |
| { |
| InitializeComponent(); |
| } |
| public ItemCollection RightButtons |
| { |
| get{ return Toolbar1.Items; } |
| } |
| } |
The problem I am having is I would like to be able to access the buttons for enabling and disabling using the names declared in the XAML file. but when I try to do this the controls are null. the Items in the toolbar they are declared under are not null.
Is there a way to make sure the controls I declared are not null so that I can access the buttons or any other control from the name I have given it?
