Telerik Forums
UI for WPF Forum
2 answers
370 views
Hi Support

I implement INotifyDataErrorInfo for my class ,It shows exception right in GridView But allow user to exit cell with invalid data.
I want to force user to correct data before leaving cell how can I do that?

public

class TestClass : INotifyDataErrorInfo  

{

        int code; 
                public int Code  

                {

                    get {return code; }

                    set 
                    {
            IsCodeValid(
value); 

            if (code != value) code = value;  

                    }

                }

        string name;

        public string Name  

                {

                    get {return name; }

                    set {name = value; }

                }

public bool IsCodeValid(int value)  

{

bool isValid = true;

if (value == 0)

{

AddError("Code", "Code Err!", false);

isValid = false;  

}

else RemoveError("Code", "Code Err!");

return isValid;

}
private
Dictionary<String, List<String>> errors = new Dictionary<string, List<string>>();

public void AddError(string propertyName, string error, bool isWarning)

{

if (!errors.ContainsKey(propertyName))  

errors[propertyName] = new List<string>();

if (!errors[propertyName].Contains(error))

{

if (isWarning) errors[propertyName].Add(error);

else errors[propertyName].Insert(0, error);

RaiseErrorsChanged(propertyName);

}

}

public void RemoveError(string propertyName, string error)  

{

if (errors.ContainsKey(propertyName) && errors[propertyName].Contains(error))

{

errors[propertyName].Remove(error);

if (errors[propertyName].Count == 0) errors.Remove(propertyName);

RaiseErrorsChanged(propertyName);

}

}

public void RaiseErrorsChanged(string propertyName)

{

if (ErrorsChanged != null)

ErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName));

}

#region

INotifyDataErrorInfo Members

public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;

public System.Collections.IEnumerable GetErrors(string propertyName)

{

if (String.IsNullOrEmpty(propertyName) || !errors.ContainsKey(propertyName))

return null;

return errors[propertyName];

}

public bool HasErrors

{

get { return errors.Count > 0; }

}

#endregion

 

 

}

 

 

<telerik:RadGridView Name="radGridView1" AutoGenerateColumns="False" ItemsSource="{Binding ColData}" >

 

<telerik:RadGridView.Columns>

 

<telerik:GridViewDataColumn Header="Code" DataMemberBinding="{Binding Code}" ValidatesOnDataErrors="Default" />

 

<telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}" />

 

</telerik:RadGridView.Columns>

 

</telerik:RadGridView>

Mehri
Top achievements
Rank 1
 answered on 12 Jul 2011
5 answers
784 views

Hi,
I am using RadGridView in a desktop WPF application. The
ItemsSource property of the grid is set to an instance of QueryableCollectionView. What I need is to hook to an event that is raised whenever the user tries to select a different row in the grid and then be able to cancel the change, depending on some user input. I tried using the CurrentChanging event of the QueryableCollectionView and set “e.Cancel = true”. As this approach works just fine with a normal WPF ListView, RadGridView doesn’t pick up the result from the CurrentChanging event of the QueryableCollectionView and the selection of the RadGridView is still moved to the new row (although the CollectionView’s current item does not change!). Can you give me a solution? Thank you!

Schokoolero50
Top achievements
Rank 1
 answered on 12 Jul 2011
3 answers
185 views
Hello Telerik team,

Not sure if this is possible using Telerik grid export.

I was able to export the data of a hierarchical grid having upto 3 levels of hierarchy using

ElementExported event.


But I want the expand collapse for different levels in the excel too.


Regards,
Mausami

 
Mausami
Top achievements
Rank 1
 answered on 12 Jul 2011
2 answers
260 views
I am using the Q1 2011 release of RadControls for Silverlight and wish to create a custom Map Provider by using the ImageProvider.  I have worked with an earlier version using the mapBaseProvider and realized you have made some significant changes that should support a lot more gis scenarios. I am using a MapServer to generate my images and have not tiled the output, the server is configured as a WMS.  I have two requests:

1. Can I use the ImageProvider option to create a custom Map Provider that will be able to render the images generated by the MapServer wms ?

2. Can you provide me with links to source code examples or documentation ?

Thanks,

Sunil
 
Sunil
Top achievements
Rank 1
 answered on 11 Jul 2011
2 answers
150 views
Hi All,

I am working on WPF 4.0 and have a requirement to custom the default style on header which we get while doing sorting on RadGridView. Instead of black triangle on header top , I need that triangle at the right side of the header while sorting.

Kindly let me know how to do it.

Parul
Top achievements
Rank 1
 answered on 11 Jul 2011
1 answer
379 views
How can I set the width by code in a column of the radsplitcontainer?

I tried setting the width of the item that's inside that column, but then the left and right overlap.

<telerik:RadDocking x:Name="radDocking" Grid.Row="1">
            <telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer>
                    <telerik:RadPaneGroup x:Name="radPaneGroup2"
                        <telerik:RadPane x:Name="radPaneTools" Header="Options">
                            <StackPanel>
                                <telerik:RadButton x:Name="btnCustomers" Content="Customers" Click="btnCustomers_Click" />
                            </StackPanel>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                    <telerik:RadPaneGroup x:Name="radPaneDocuments" SelectionChanged="radPaneDocuments_SelectionChanged">
                        <telerik:RadPane x:Name="radPane1" Header="Document 1">
                            <TextBlock TextWrapping="Wrap" Text=""></TextBlock>
                        </telerik:RadPane>
                        <telerik:RadPane x:Name="radPane2" Header="Document 2">
                            <TextBlock TextWrapping="Wrap" Text=""></TextBlock>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking.DocumentHost>
        </telerik:RadDocking>

I want to make the radPaneGroup2 width fixed, but I can't manage to do it, without it overlapping radPaneDocuments.

Thanks in advance.
Ivo
Telerik team
 answered on 11 Jul 2011
1 answer
90 views
Hi,

I'm deriving our custom grid from the RadGridView control and adding a couple of parts to the control template to include a RadDataFilter and a RadDataPager. I want to set up the sources such that when the ItemsSource property is set on the GridView, it actually sets the RadDataFilter Source property and then the RadDataPager Source would be the filter's FilteredSource, and finally the GridView ItemsSource should actually be the pager's PagedSource. How can I achieve this? Basically, when the consumer of this control sets the ItemsSource on the grid, I don't know how to intersect that and have the bindings as I describe here.

Thanks,
LauraH
Rossen Hristov
Telerik team
 answered on 11 Jul 2011
1 answer
193 views
Hi

I have a global style set within a resource dictionary for all telerik:RadGridView's within my solution. I'm using the telerik transparent theme as my base, but have restyled a number of elements (row highlights, fitler drop down icon, header row etc), all of which I have applied to all grids without a problem.

I would like to do the same with the FilterControl - in the first instance, I would simply like to change the theme of the the FilterControl and all it's elements to the telerik Office_BlackTheme.

I have tried setting:

<Style TargetType="{x:Type telerik:FilteringControl}>
        <Setter Property="telerik:StyleManager.Theme"    Value="Office_BlackTheme"/>
<Style>

But this had no effect at all.

I have accessed the FilterConrol Template using Blend and ensured that all elements within the template are using the Office_BlackTheme (although I didn't see a DatePicker & Calendar in there?) - and I have successfully managed to get this to apply to all grids within my solution.
 
However, I end up with the same filter options for all columns no matter what the data type - i.e. Date/Time fields have no DatePicker to filter by date -  and also none of the filter options that are available are populated - I just have an empty listbox and empty combo-boxes.

NB: All our grids use AutoGenerateColumns and contain a number of different types of data: text, dates, times, numbers.

Can you please help - all I really want to do is have a FilterControl using the Office_BlackTheme within my Grid which uses a modified TransparentTheme.

Thanks

Simon

Vanya Pavlova
Telerik team
 answered on 11 Jul 2011
1 answer
672 views
Hi, I'm looking for a way to remove excess height in GridView rows. I need to display a lot of rows in as small a vertical space as possible, so ideally, I'd like to adjust the padding that seems to be present in the grid rows (or perhaps it's actually applied in the grid cells; I couldn't be sure when I ran Snoop over the GridView control). This image shows the areas I'd like to reduce, in red. I have attached styles to the GridViewCell and GridViewRow, and set the Margin and Padding to be 0, but to no avail. As I mentioned, I tried to use Snoop to determine which control was applying extra padding to the rows, but couldn't locate it. It seems like a default. I'd like to avoid explicitly setting a height for each row, but that doesn't seem to work anyway (setting the MinHeight and Height to something like 12 causes the row to be 12px high, but the content inside is cut off at the bottom, not vertically centred in the row. And setting VerticalContentAlignment on the row style doesn't work, either).

So, any help with this issue would be much appreciated.
Vanya Pavlova
Telerik team
 answered on 11 Jul 2011
1 answer
166 views
Dear all,
I have to implement a gridview with the following behaviour:
  • User enables a mode (new, update or delete)
  • and when he manipulates some data - let's say changes the contents of a cell - the new contents is displayed bold - to visualize the change.
  • So, after some changes he can press an "update" button and this works like a DB commit - all bold cells are saved and drawn with standard font weight again.
  • If he enters the original value before commit, the font weight should go back to normal.
  • If he presses a "cancel" button, all changed values should switch back to the original ones - and be shown with normal font weight.

Question is where to start?
I have seen the HistoryManager example, which deals with dirty data, this is a little bit more than I need.
There is also a nice example showing the CellStyleSelector using a UnitPriceConveter to change the cell style depending on its contents.

So my theortical approach is:
ItemSource class is an observable collection of IEditableObject items. Each editable item as an "oldvalue" field.
and this is somehow connected to the StyleSelector.

One of the missing parts is, when the user deletes a row, how should this be shown? I have seen other grids, that show a marker on the left side, indicating that this row will be deleted at next save/commit. How difficult is this to achieve?

Has someone done something similar?
Any help would be really appreciated.

Cheers,
Hermann

 
Ivan Ivanov
Telerik team
 answered on 11 Jul 2011
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?