|
HI,
I am migrating from RadShceduler control from RadScheduleView for some performance problem. The requirement is to invoke the appointment create event in single click. In scheduler we have the TimeSloteItem which is not in RadScheduleView. I created a control template for timeslotitem and had the inputbindings to invoke the radscheduler appointment create event. I dont know how to achieve this in RadScheduleView. Plz Help... I used the following style..
<br />
<Style x:Key="AllDayTimeSlotStyle" TargetType="{x:Type telerik1:TimeSlotItem}"><br />
<br />
<Setter Property="Template"><br />
<Setter.Value><br />
<ControlTemplate TargetType="{x:Type telerik1:TimeSlotItem}"><br />
<Grid x:Name="LayoutRoot"><br />
<Grid.InputBindings><br />
<MouseBinding MouseAction="LeftClick" Command="commands:SchedulerCustomCommands.CreateAppointment" CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}" /><br />
</Grid.InputBindings><br />
.<br />
.<br />
.<br />
.<br />
.<br />
</ControlTemplate><br />
</Setter.Value><br />
</Setter><br />
</Style><br />
|
|
|
|
|
I find telerik support absolutely excellent for their controls, generally a sample app appears to solve most issues. Have you tried their forums.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi Jeyakumarbics1,
You don't need to create new template for TimeSlotItem. You need to attach function to MouseLeftButtonUp of RadScheduleView and in body of this function you need to create and execute CreateAppointment command.
private void ScheduleView_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
System.Windows.Input.RoutedUICommand createAppointment = RadScheduleViewCommands.CreateAppointment;
createAppointment.Execute(null, this.ScheduleView);
}
|
|
|
|
|
Hi,
I want to invoke the appointment create event in RadScheduleView with mouse single click instead of double click. By default it is invoked in mouse double click. How to get this done?
Plz Help? Urgent...
|
|
|
|
|
if (true == ((List<Author>)DG.ItemsSource).Any(el =>; el.Name == CurrentInput))
{
MessageBox.Show("Looking in column: " + ????? );
}
I don' t want to be always in the column Name, but in which is current. DG is the DataGrid. How?
|
|
|
|
|
I don't understand the question.
The columns are generally bound to some property in the data object for the row (the collection of these data items is the datagrid's ItemsSource). The datagrid's SelectedItem property will give you that object.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
1) You don't need "true =="
2) You don't need a semicolon after the => in your anonymous function
Anyway... You should be using FirstOrDefault() instead of Any(). That'll return the item that satisfied the condition, instead of just letting you know that such an item exists.
For example:
Person p = lstPeople.FirstOrDefault(a => a.Age > 18);
if (p != null)
{
}
|
|
|
|
|
I have a number of combo boxes on a datagrid, which are linked together using binding. So, if you select an item in the first combo then the user is presented with a list of values in the second based upon their selection in the first.
However, the problem I have is when the user changes their selected item in the first combo box, the list of values in the second is not updating to reflect the new selected item from the first.
My mark up in the combobox is
<ComboBox ItemSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type toolkit:DataGrid}}, Path=DataContext.Cars.SelectedCar}"
DisplayMemberPath="Car"
SelectedValuePath="Car"
SelectedItem="{Binding Path=SelectedCar, Mode=TwoWay, UpdateSourceTrigger}"
IsSynchronizedWithCurrentItem="True"/>
Can only please help??????????????????
|
|
|
|
|
I would guess that your path is wrong Path=DataContext.Cars.SelectedCar, SelectedCar doesn't sound like a list of objects.
If your path is not wrong, you should post a description of your source your binding against and the xaml for your datagrid with the comboboxes.
|
|
|
|
|
Hai!!!!!
How to update datas in silverlight Data grid. I used Following code But Getting Error in Linq query in service like .....
Argument Null Exception unhandle by user ...:
Value cannot be null.
Parameter name: entity
in this line : Dbcls.Bill_Applications.Attach(objBill,true);
This is my COde :
bill.xaml.cs
==============
public Bill()
{
InitializeComponent();
dgSilverlight.BeginningEdit +=new EventHandler<DataGridBeginningEditEventArgs>(dgSilverlight_BeginningEdit);
dgSilverlight.RowEditEnded +=new EventHandler<DataGridRowEditEndedEventArgs>(dgSilverlight_RowEditEnded);
}
void dgSilverlight_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e)
{
MyBill_Application.ServiceReference1.Bill_Application objData = e.Row.DataContext as MyBill_Application.ServiceReference1.Bill_Application;
MyBill_Application.ServiceReference1.BILL_WCFServiceClient webservice = new MyBill_Application.ServiceReference1.BILL_WCFServiceClient();
webservice.Edit_User_Bill_InformationCompleted +=new EventHandler<Edit_User_Bill_InformationCompletedEventArgs>(webservice_Edit_User_Bill_InformationCompleted);
webservice.Edit_User_Bill_InformationAsync(objData);
}
protected void webservice_Edit_User_Bill_InformationCompleted(object sender, MyBill_Application.ServiceReference1.Edit_User_Bill_InformationCompletedEventArgs e)
{
bool result = Convert.ToBoolean(e.Result);
if (result)
{
}
}
void dgSilverlight_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{
}
And Service Page
Service.srv.cs
=====================
[OperationContract]
public bool Edit_User_Bill_Information(Bill_Application objBill)
{
Dbcls.Log = new Vandermotten.Diagnostics.DebuggerWriter();
Dbcls.Bill_Applications.Attach(objBill,true); ***Error*** :doh:
Dbcls.SubmitChanges();
return true;
}
Can you please Help me out ?
Thanks and Regards,
Sanjay
|
|
|
|
|
From the error, it looks like you have no data.
Make sure you have data for the query that you are using.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
I have code to add my tab items to the control and it works, however in the Microsoft Visual C# 2010 editor my tab shows up as a big gray box with no controls. When I run the program the tabs have there controls. Here is my TabItem
<br />
<br />
<TabItem xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="ThisMyTab" x:Class="GoCenter.MyTab" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800"><br />
<br />
<Grid><br />
My Controls here<br />
</Grid><br />
<br />
</TabItem >
David W Wright
|
|
|
|
|
david1313 wrote: I have code to add my tab items to the control and it works
So you are adding tabitems using code, yes?
I'm not sure how much of the construction/initialization code the editor runs in the classes we code, but if it's not showing up in the designer then you could always put a dummy TabItem in the XAML.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, I'm adding tabs using code. How do you create a dummy TabItem?
David W Wright
|
|
|
|
|
Put that XAML in the TabControl if it's in XAML or add an item in the constructor perhaps?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm trying to make a tab with a close button (a la Firefox and pretty much everything else that uses tabs), and was trying to follow this tutorial:
How to add a Close button to a WPF TabItem[^]
Unfortnately, it doesn't seem to work. The problem appears to be that in the ClosableHeader class there is a button, defined in the xaml, with
Name="button_close" It's then referenced in the C# code for the ClosableTab class as follows:
CloseableHeader closableTabHeader = new CloseableHeader();
this.Header = closableTabHeader;
closableTabHeader.button_close.MouseEnter += new MouseEventHandler(button_close_MouseEnter);
closableTabHeader.button_close.MouseLeave += new MouseEventHandler(button_close_MouseLeave);
closableTabHeader.button_close.Click += new RoutedEventHandler(button_close_Click);
closableTabHeader.label_TabTitle.SizeChanged += new sizeChangedEventHandler(label_TabTitle_SizeChanged);
This generates compile-time errors for every line that contains the text
closableTabHeader.button_close with the message "'WGPM.Views.CloseableHeader' does not contain a definition for 'button_close' and no extension method 'button_close' accepting a first argument of type 'WGPM.Views.CloseableHeader' could be found (are you missing a using directive or an assembly reference?)" (WGPM.Views is the namespace I'm using).
What am I missing? Can I not just refer to a named control like that?
Thanks,
Juliean.
|
|
|
|
|
Sounds to me like either your XAML or code behind class is in the wrong namespace. They have to be in the same namespace to access stuff the way you are trying to.
|
|
|
|
|
Wouldn't that cause an error on the line where the CloseableHeader is created? If it was in a different namespace, I'd get a compile error at that time, wouldn't I? The CloseableHeader gets created correctly, and the assignment of it to the ClosableTab works, but the reference to button_close and label_TabTitle doesn't.
|
|
|
|
|
Not necessarily. The names such as "button_close" and "label_TabTitle" are actually defined in a compiler generated partial class thats not shown in Visual Studio. So the class itself might be in your scope, but the stuff inside it may not be.
Post more of your XAML and .cs class so we can take a look.
|
|
|
|
|
Look in the generated code (CloseableHeader.g.cs)....is the button_close member defined there? And if so, what is its access modifier?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ok, I'm missing something here. I don't have a CloseableHeaders.g.cs file. All I have is CloseableHeader.xaml and CloseableHeader.xaml.cs
I'm posting the listings of the xaml and the two .cs files (is there a way to add an attachment on this forum?), but they are just copied from the tutorial with virtually no changes.
I'm starting to lean towards this being a namespace issue, as I want the namespace to be WGPM.Views, but as far as directory structure it's in WGPM\Views\BaseClasses
I'm using VS10, .Net 4.0, Win7/64.
CloseableHeader.xaml:
<UserControl x:Class="CloseableHeader"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="23" d:DesignWidth="81" Margin="0"
xmlns:local="clr-namespace:WGPM.Views">
<Grid>
<Button Content="X" Height="19" HorizontalAlignment="Right" Margin="0,3,4,0" Name="button_close" VerticalAlignment="Top" Width="20" FontFamily="Courier" FontWeight="Bold" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" FontStretch="Normal" Visibility="Visible" FontSize="14" Padding="0" ToolTip="Close"/>
<Label Content="TabItem" Height="23" HorizontalAlignment="Left" Margin="4,1,0,0" Name="label_TabTitle" VerticalAlignment="Top" FontFamily="Courier" FontSize="12" />
</Grid>
</UserControl>
CloseableHeader.xamls.cs:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace WGPM.Views
{
public partial class CloseableHeader : UserControl
{
public CloseableHeader()
{
InitializeComponent();
}
}
}
ClosableTab.cs
using System;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace WGPM.Views
{
class ClosableTab : TabItem
{
public ClosableTab()
{
CloseableHeader closableTabHeader = new CloseableHeader();
this.Header = closableTabHeader;
closableTabHeader.button_close.MouseEnter += new MouseEventHandler(button_close_MouseEnter);
closableTabHeader.button_close.MouseLeave += new MouseEventHandler(button_close_MouseLeave);
closableTabHeader.button_close.Click += new RoutedEventHandler(button_close_Click);
closableTabHeader.label_TabTitle.SizeChanged += new SizeChangedEventHandler(label_TabTitle_SizeChanged);
}
public string Title
{
set
{
((CloseableHeader)this.Header).label_TabTitle.Content = value;
}
}
protected override void OnSelected(RoutedEventArgs e)
{
base.OnSelected(e);
((CloseableHeader)this.Header).button_close.Visibility = Visibility.Visible;
}
protected override void OnUnselected(RoutedEventArgs e)
{
base.OnUnselected(e);
((CloseableHeader)this.Header).button_close.Visibility = Visibility.Hidden;
}
protected override void OnMouseEnter(MouseEventArgs e)
{
base.OnMouseEnter(e);
((CloseableHeader)this.Header).button_close.Visibility = Visibility.Visible;
}
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
if (!this.IsSelected)
{
((CloseableHeader)this.Header).button_close.Visibility = Visibility.Hidden;
}
}
void button_close_MouseEnter(object sender, MouseEventArgs e)
{
((CloseableHeader)this.Header).button_close.Foreground = Brushes.Red;
}
void button_close_MouseLeave(object sender, MouseEventArgs e)
{
((CloseableHeader)this.Header).button_close.Foreground = Brushes.Black;
}
void button_close_Click(object sender, RoutedEventArgs e)
{
((TabControl)this.Parent).Items.Remove(this);
}
void label_TabTitle_SizeChanged(object sender, SizeChangedEventArgs e)
{
((CloseableHeader)this.Header).button_close.Margin = new Thickness(((CloseableHeader)this.Header).label_TabTitle.ActualWidth + 5, 3, 4, 0);
}
}
}
|
|
|
|
|
jgalak wrote: I don't have a CloseableHeaders.g.cs file
If that's the case then no, it's not going to work because the members are truly not part of the class.
Right-click on the "InitializeComponent()" in your CloseableHeader.xaml.cs file....choose "Go to definition".That should bring you to the generated file (CloseableHeaders.g.cs) - the other half of your partial usercontrol class. Does it?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote:
Right-click on the "InitializeComponent()" in your CloseableHeader.xaml.cs file....choose "Go to definition".That should bring you to the generated file (CloseableHeaders.g.cs) - the other half of your partial usercontrol class. Does it?
No, it doesn't. In fact, that's one of the compile errors that comes up.
Is there a way to force it to create the generated file?
|
|
|
|
|
Just create a new usercontrol by adding one to your project. Then copy the code into your new xamlcs files.
Or if you have the source code from the article then the g.cs file should be in there.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You are missing the obvious Mark. Its a namespace issue just as I originally said 2 days ago, but OP chose to ignore my advice . He is missing the namespace in his x:class.
|
|
|
|