Telerik Forums
UI for WPF Forum
0 answers
90 views
Hi,
I try to understand the working of the demo application. I can build the app. But when I open the SingleExample.xaml, The designer throws up an exception:
"Exception was thrown on QuickNavigation: Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception."
with the details
"Cannot find resource named 'NavigateCommand'. Resource names are case sensitive.
   at System.Windows.StaticResourceExtension.ProvideValueInternal(IServiceProvider serviceProvider, Boolean allowDeferredReference)
   at System.Windows.StaticResourceExtension.ProvideValue(IServiceProvider serviceProvider)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)"

With 900 lines of xaml code, it is difficult to understand what is happening here. When I'm able to use the designer, I can pinpoint better the pieces I want to reuse.

How can I get a valid xaml-file for the designer?

Regards,
Alfons
Top achievements
Rank 2
 asked on 06 Sep 2012
2 answers
1.3K+ views

I am using WPF having a strange issue with RadListBox SelectedItem databinding, trying to figure out but no luck. Following is my scenario

  1. I am using Telerik Controls (RadListBox, and RadButton)
  2. RadButton is placed inside a ItemsControlRadListBox and ItemsControl are bind to sameItemsSource.
  3. I am using PRISM and MVVM.
  4. What I want is when I click on button, the same item is selected from RadListBox automatically,(This part working fine).
  5. Problem: As soon as I click on any item of RadListBox and then click back on any button the item selection stops working.
  6. Even more strange thing: I tried the same thing with standard WPF ListBox by adding attached behavior for selection changed event and attached property of Command and CommandParameter, it works fine, so it looks like an issue with Telerik RadListBox ?

Now let me come to code.

ViewModel Class 

public class MainViewModel : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
 
    // Create the OnPropertyChanged method to raise the event
    protected void OnPropertyChanged(string name)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(name));
        }
    }
 
    public DelegateCommand<object> StudentSelected { get; set; }
    public DelegateCommand<object> ButtonPressed { get; set; }
 
    private void OnStudentSelected(object par)
    {
        //Debugger.Break();
        if (handled == false)
        {
            Student std = par as Student;
            if (std != null)
            {
                SelectedStudent = std;
            }
        }
        handled = false;
    }
 
    private void OnButtonPressed(object par)
    {
        //Debugger.Break();
        handled = true;
        String std = par as String;
        if (std != null)
        {
            foreach (Student st in _students)
            {
                if (st.Name.Equals(std))
                {
                    SelectedStudent = st;
                    break;
                }
            }
        }
    }   
 
    private Student _selectedstudent;
    private bool handled = false;
 
 
    public MainViewModel()
    {
        StudentSelected = new DelegateCommand<object>(OnStudentSelected);
        ButtonPressed = new DelegateCommand<object>(OnButtonPressed);
    }
 
    public Student SelectedStudent
    {
        get
        {
            return _selectedstudent;
        }
        set
        {
            _selectedstudent = value;
            OnPropertyChanged("SelectedStudent");
        }
    }
 
 
    private ObservableCollection<Student> _students;
    public ObservableCollection<Student> Students
    {
        get
        {
            return _students;
        }
        set
        {
            _students = value;
            OnPropertyChanged("Students");
        }
    }
}
 
public class Student
{
    public String Name { get; set; }
    public String School { get; set; }
}

MainView XAML 

<telerik:RadListBox Grid.Column="0" Grid.Row="0" ItemsSource="{Binding Students}" Command="{Binding StudentSelected}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Path=SelectedItem}" SelectedItem="{Binding SelectedStudent, Converter={StaticResource DebugConverter}}">
<!-- The above debug converter is just for testing binding, as long as I keep on clicking button the Converter is being called, but the moment I click on RadListBoxItem the Converter is not called anymore, even when I click back on buttons -->
                <telerik:RadListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}"></TextBlock>
                    </DataTemplate>
                </telerik:RadListBox.ItemTemplate>
            </telerik:RadListBox>
            <Label Grid.Row="0" Grid.Column="1" Content="{Binding SelectedStudent.Name}"></Label>
            <StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal">
                <ItemsControl ItemsSource="{Binding Students}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <telerik:RadButton Width="100" Height="70" Content="{Binding Name}" Command="{Binding RelativeSource={RelativeSource FindAncestor,
    AncestorType={x:Type Window}}, Path=DataContext.ButtonPressed}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Content}">
                        </telerik:RadButton>
                    </DataTemplate>   
                    </ItemsControl.ItemTemplate>
 
                </ItemsControl>
            </StackPanel>

and finally populating the ViewModel and setting the Datacontext 

MainViewModel mvm = new MainViewModel();
ObservableCollection<Student> students = new ObservableCollection<Student>();
students.Add(new Student { Name = "Student 1", School = "Student 1 School" });
students.Add(new Student { Name = "Student 2", School = "Student 2 School" });
students.Add(new Student { Name = "Student 3", School = "Student 3 School" });
 
mvm.Students = students;
 
//Bind datacontext
this.DataContext = mvm;

Please give your suggestions and share you expertise.

I have created a demo project replicating the above scenario, please let me know if it is required?

Muhammad Ummar
Top achievements
Rank 1
 answered on 06 Sep 2012
0 answers
66 views
Hi,

Is it possible to be notified when a user freezes columns in the RadGridView?

Thanks in advance!

Arthur
Arthur
Top achievements
Rank 1
 asked on 05 Sep 2012
0 answers
150 views
Just started testing this component,

Managed to get the PropertyGrid to update another UI control (button) so can change the size of the button  by changing the properties in the grid.

I will actually need to bind the PropertyGrid to a object in a View Model (which I have done) but when I change the details in the property grid the underlying object is not updated. 

Note I have linked up INotifyPropertyChanged etc as normal. So is there anything else that I need to do other that this 

Thanks

Arthur
Arthur
Top achievements
Rank 1
 asked on 05 Sep 2012
4 answers
100 views
Hello there,

I am currently developing a mapping application with WPF radmap for my company.
Therefore I have a question:

I have multiple arrows (WPF path shape) for which I also have locations in Lat/Lon.
I want to show these arrows on an InformationLayer, which works fine by just using MapLayer.SetLocation and InformationLayer's Items property.
My problem is now that I have a set of arrow-sets (imagine a list of tours and each tour has a set of direction arrows) and I need a 1to1 relation between objects on the information layer and my model (e.g. if a tour is deleted i want to remove the corresponding polyline and the corresponding arrows).
Is there any kind of CompositeMapShape which can have arbitrary WPF FrameworkElements (all of them have their own MapLayer location) as children?

Best regards,
Markus
Markus
Top achievements
Rank 1
 answered on 05 Sep 2012
1 answer
86 views

Hi,

I have an unexpected behavior with Docking control. To reproduce the issue, you can use the WPF Docking First Look example. Follow these steps:

  • Start the demo Docking First Look WPF Demo
  • Unpin the "Server tab explorer"
  • Click on the "hidden" "Server Explorer" tab (it appears)
  • Unpin the "Solution explorer" tab
  • "Server explorer" doesn't close!
  • Pin the the "Solution explorer" tab
  • Unpin the "Solution explorer" tab
  • "Server Explorer" tab opens unexpectedly after each attempt

You can use all of the docking examples to reproduce the issue.
The issue exist in Silverlight too.

 Is there a way to avoid this?

Thanks,
Christophe

Georgi
Telerik team
 answered on 05 Sep 2012
3 answers
64 views
Hello Team,

we like to give the user the possibility to select and deselect a PointMark in a LineSeriesDefinition.
Simply in the event ItemClick we change the brush of the .Fill property. But surprisingly, if we set the original brush (= nothing in the example), the view don't change.

This is the relevant code:
Private _manualPointMarkFill As Brush
Private _manualSelectedPointMark As PointMark

Private Sub SetPointMarkSelectedState()
    _manualPointMarkFill = _manualSelectedPointMark.Fill
    _manualSelectedPointMark.Fill = New SolidColorBrush(Colors.Black)
End Sub

Private Sub ClearPointMarkSelectedState()
    If _manualSelectedPointMark IsNot Nothing Then
        'The Color of the PointMark do not reset to white, the PointMark remains black.
        _manualSelectedPointMark.Fill = _manualPointMarkFill

        'That works, but is only correct if the PointMark was white before.
        '_manualSelectedPointMark.Fill = Brushes.White

        _manualSelectedPointMark = Nothing
    End If
End Sub

I have made a little example project (*.Zip), but those files are not allowed to attach??

Do you have an explanation for this behaviour and a functioning idea?
Thank you
Sia
Telerik team
 answered on 05 Sep 2012
1 answer
138 views
HI,
I'm using RadSchedulerView and i would like to disable the animation when ViewDefinitionChanged occurs.
what should i do?


thanks
Yana
Telerik team
 answered on 05 Sep 2012
1 answer
113 views
Hello 

Yes, its more a feature request than a issue. We have tool which is showing items (attachment). This items organized as a tree. That tool is self made and not the best code behind.
I am wondering, is it possible to use the 
 TreeMap with PieCharts or something similar instead of rectangle as style? 
And how to do that?

Thank you :)
Evgenia
Telerik team
 answered on 05 Sep 2012
0 answers
110 views
Hello,

is it possible to manually set/modify a splitter's position (from codebehind/XAML)?
I have a splitcontainer with 2 radpanegroups in the DocumentHost.

Thanks for your help!

Regards,
Thomas
Thomas Felis
Top achievements
Rank 1
 asked on 04 Sep 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?